Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/generators/html/refiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ def _highlight_code_blocks(self, soup) -> None:
code["class"] = classes
code["data-highlighted"] = "generator"

fragment = BeautifulSoup(f"<code>{rendered}</code>")
# The <pre> tag is necessary to have the lxml parses retain whitespace for indentation
fragment = BeautifulSoup(f"<pre><code>{rendered}</code></pre>")
highlighted = fragment.code
code.clear()
for child in list(highlighted.contents):
Expand Down
Loading