diff --git a/app/main.py b/app/main.py
index 6dc4c2b..90ef66f 100644
--- a/app/main.py
+++ b/app/main.py
@@ -66,6 +66,7 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac
# TODO(ts):
#
# Next:
+# - DB models for webmentions
# - allow to undo follow requests
# - indieauth tweaks
# - API for posting notes
diff --git a/app/utils/highlight.py b/app/utils/highlight.py
index 1413e7d..4334cb3 100644
--- a/app/utils/highlight.py
+++ b/app/utils/highlight.py
@@ -16,9 +16,12 @@ def highlight(html: str) -> str:
for code in soup.find_all("code"):
if not code.parent.name == "pre":
continue
- lexer = guess_lexer(code.text)
+ code_content = (
+ code.encode_contents().decode().replace("
", "\n").replace("
", "\n")
+ )
+ lexer = guess_lexer(code_content)
tag = BeautifulSoup(
- phighlight(code.text, lexer, _FORMATTER), "html5lib"
+ phighlight(code_content, lexer, _FORMATTER), "html5lib"
).body.next
pre = code.parent
pre.replaceWith(tag)