from prompt_toolkit.formatted_text import to_formatted_text, HTML
from prompt_toolkit import print_formatted_text
html = HTML('<aaa>Hello</aaa> <bbb>world</bbb>!')
text = to_formatted_text(html, style='class:my_html bg:#00ff00 italic')
print_formatted_text(text)
I assume this is not what was intended? So it is less clear what it is intended to show and how. It also does not accept a prompt_toolkit.styles.Style object as style, as one would have expected or hoped.
Thank you for reporting, @2sn!
This is a bug indeed. I have to think about it, because solving it might require some changes that could break other stuff.
The example on https://python-prompt-toolkit.readthedocs.io/en/2.0.5/pages/printing_text.html
produces just the output
[('class:my_html bg:#00ff00 italic class:aaa', 'Hello'), ('class:my_html bg:#00ff00 italic ', ' '), ('class:my_html bg:#00ff00 italic class:bbb', 'world'), ('class:my_html bg:#00ff00 italic ', '!')]
.I assume this is not what was intended? So it is less clear what it is intended to show and how. It also does not accept a
prompt_toolkit.styles.Style
object as style, as one would have expected or hoped.