From 82a4f48c7b39dedaafdb0b5f9a65576af4386aec Mon Sep 17 00:00:00 2001
From: Aiq0 <66842415+Aiq0@users.noreply.github.com>
Date: Thu, 14 May 2026 16:49:33 +0200
Subject: [PATCH 1/4] chore: update katex
---
seminare/style/templates/root_base.html | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/seminare/style/templates/root_base.html b/seminare/style/templates/root_base.html
index 336eae7..bd5f626 100644
--- a/seminare/style/templates/root_base.html
+++ b/seminare/style/templates/root_base.html
@@ -13,9 +13,9 @@
-
-
-
+
+
+
@@ -122,7 +122,6 @@
{left: '\\[', right: '\\]', display: true}
],
macros: macros,
- throwOnError: false
});
});
From 4041729ae380b622b0d90afc4e5c6a0a43cdbf1a Mon Sep 17 00:00:00 2001
From: Aiq0 <66842415+Aiq0@users.noreply.github.com>
Date: Thu, 14 May 2026 16:50:15 +0200
Subject: [PATCH 2/4] fix: do not parse markdown in math elements
---
seminare/style/markdown_extensions.py | 31 +++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/seminare/style/markdown_extensions.py b/seminare/style/markdown_extensions.py
index 4d7679e..6857251 100644
--- a/seminare/style/markdown_extensions.py
+++ b/seminare/style/markdown_extensions.py
@@ -4,6 +4,7 @@
from markdown import Extension, Markdown
from markdown.blockprocessors import BlockProcessor
+from markdown.postprocessors import Postprocessor
from markdown.preprocessors import Preprocessor
from markdown.treeprocessors import Treeprocessor
@@ -133,6 +134,34 @@ def fence_logic(self, parent, blocks):
self.parser.parseBlocks(d, blocks)
+class MathPreprocessor(Preprocessor):
+ MATH_RE = re.compile(r"(? list[str]:
+ text = "\n".join(lines)
+
+ if not hasattr(self.md, "math_stash"):
+ self.md.math_stash = []
+
+ def repl(match):
+ # No underscores, so markdown ignores it
+ placeholder = f"MATH_STASH_{len(self.md.math_stash)}_ENDSTASH"
+ self.md.math_stash.append(match.group(1))
+ return placeholder
+
+ new_text = self.MATH_RE.sub(repl, text)
+ return new_text.split("\n")
+
+
+class MathPostprocessor(Postprocessor):
+ def run(self, text: str) -> str:
+ if hasattr(self.md, "math_stash"):
+ for i, math_text in enumerate(self.md.math_stash):
+ placeholder = f"MATH_STASH_{i}_ENDSTASH"
+ text = text.replace(placeholder, math_text)
+ return text
+
+
class SeminareExtension(Extension):
def __init__(self, image_root: str | None = None, **kwargs) -> None:
super().__init__(**kwargs)
@@ -152,3 +181,5 @@ def extendMarkdown(self, md: Markdown) -> None: # noqa: N802
md.parser.blockprocessors.register(
IOOutputBlockProcessor(md.parser), "IO_output", 100000
)
+ md.preprocessors.register(MathPreprocessor(md), "math_stash", 100005)
+ md.postprocessors.register(MathPostprocessor(md), "math_restore", 100005)
From d245d58b04a90942823bb454ee6dea2ccdd43783 Mon Sep 17 00:00:00 2001
From: Aiq0 <66842415+Aiq0@users.noreply.github.com>
Date: Sat, 16 May 2026 13:52:45 +0200
Subject: [PATCH 3/4] fix: accept all katex patterns
---
seminare/style/markdown_extensions.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/seminare/style/markdown_extensions.py b/seminare/style/markdown_extensions.py
index 6857251..4c88ca5 100644
--- a/seminare/style/markdown_extensions.py
+++ b/seminare/style/markdown_extensions.py
@@ -135,7 +135,9 @@ def fence_logic(self, parent, blocks):
class MathPreprocessor(Preprocessor):
- MATH_RE = re.compile(r"(? list[str]:
text = "\n".join(lines)
@@ -144,7 +146,6 @@ def run(self, lines: list[str]) -> list[str]:
self.md.math_stash = []
def repl(match):
- # No underscores, so markdown ignores it
placeholder = f"MATH_STASH_{len(self.md.math_stash)}_ENDSTASH"
self.md.math_stash.append(match.group(1))
return placeholder
From 83256da31f4dc4d4e2c3ae2dcccd1e9b3240005d Mon Sep 17 00:00:00 2001
From: Aiq0 <66842415+Aiq0@users.noreply.github.com>
Date: Wed, 17 Jun 2026 12:42:00 +0200
Subject: [PATCH 4/4] fix: try to match katex escaping behavior
---
seminare/style/markdown_extensions.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/seminare/style/markdown_extensions.py b/seminare/style/markdown_extensions.py
index 4c88ca5..5690210 100644
--- a/seminare/style/markdown_extensions.py
+++ b/seminare/style/markdown_extensions.py
@@ -136,7 +136,7 @@ def fence_logic(self, parent, blocks):
class MathPreprocessor(Preprocessor):
MATH_RE = re.compile(
- r"(? list[str]: