Open dmitry-radzevich opened 3 years ago
From https://www.crummy.com/software/BeautifulSoup/bs4/doc/:
The
prettify()
method will turn a Beautiful Soup parse tree into a nicely formatted Unicode string, with a separate line for each tag and each string: ... Since it adds whitespace (in the form of newlines),prettify()
changes the meaning of an HTML document and should not be used to reformat one. The goal ofprettify()
is to help you visually understand the structure of the documents you work with.
Please see facelessuser/pymdown-extensions#1312 for a full context and examples. In short: pretty-printing of HTML caused by this extension inserts extra spaces that negatively affect how the output looks in
<sub/>
and<sup/>
cases:Original HTML / rendering:
"Beautified" HTML / rendering (notice extra spaces before subscripts and superscripts):
Perhaps it's the prettification step that mangles the output HTML: