Yes! PyCharm can do both...
To have both functionalities in a Python string containing HTML first requires using an IDE functionality called "Language injections".
In the context of the IDE "Syntax checks" are usually called "Inspections" and "Syntax highlighting" is under "Color Scheme", as follows (compare with the Python entries in the same sections):
Functionalities |
IDE path to dialogue |
Syntax checks |
Settings > Editor > Inspections > HTML |
Syntax highlights |
Settings > Editor > Color Sheme > HTML |
Using Language Injections:
The best guide I've found on the JetBrains site is: "Language injections (for IntelliJ IDEA)", it follows the exact same steps as the guide for the PyCharm IDE but is more elaborate. (I also liked this youtube video that shows how to do "Language injections" for several different languages.)
I used the following Python code separating the string with a backslash \
because it's easier for seeing syntax error warnings on separate lines:
# language=HTML prefix=<body> suffix=<body>
your_python_string = '\
<body text=""><h1>some header text</h1></body>\
t<br></br> \
<dir>\
'
Having said that, lets configure the functionalities:
Start by clicking inside the Python string literal and press Alt + Enter or click in light bulb pop-up; choose "Inject language or reference" and next choose "HTML" as show below, the background color of the string literal should change:

Syntax checks (or Inspections) to the HTML:
At this point if you press Alt + 6 (running Inspect Code
gives additional warnings) there should be a docked window with the HTML warnings and syntax check. You will also have HTML code hints available:

Syntax highlights:
This dialogue is integrated into the PyCharm per language, after having activated "Language injection" for the string literal it already has HTML specific highlight, you can adjust the color scheme for better contrast to your preference:

A final thought:
The warnings that are emitted by PyCharm for HTML are shown in the screenshot below. Other functionalities associated with HTML files are also available in the HTML injected string.
