aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-04-08 23:17:37 +0200
committerEddy Pedroni <epedroni@pm.me>2025-04-08 23:17:37 +0200
commitdb6e135a777ca67534de4af7d3cb677e2d06ff76 (patch)
tree5f036f25214ca302ba615d722b5133fa23259ee9
parentbdc92e46434be18561f76da9e2b0729db5b4bf21 (diff)
Switched to custom markdown processor with safe filter
-rw-r--r--godocs.py6
-rw-r--r--requirements.txt2
2 files changed, 4 insertions, 4 deletions
diff --git a/godocs.py b/godocs.py
index 072d5df..87396cd 100644
--- a/godocs.py
+++ b/godocs.py
@@ -27,18 +27,18 @@ class Page:
def renderPageCallback(template_file: Path, stylesheet_url: str) -> Callable[[Page, str], None]:
""" Callback to process the provided page metadata and output the final page to the filesystem """
from jinja2 import Environment, FileSystemLoader, select_autoescape
+ from markdown import markdown
env = Environment(
loader=FileSystemLoader(template_file.parent),
- autoescape=select_autoescape(),
- extensions=["jinja_markdown.MarkdownExtension"]
+ autoescape=select_autoescape()
)
template = env.get_template(template_file.name)
def entries(page: Page) -> Iterator[str]:
for entry in page.entries:
with open(entry, "r") as f:
- yield f.read()
+ yield markdown(f.read(), extensions=["fenced_code", "tables"])
def render(page: Page, site_title: str, navigation: list[dict[str, str]]) -> None:
print(f"Rendering {page.output}")
diff --git a/requirements.txt b/requirements.txt
index 589ec47..94f6f1a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
click==8.1.8
markdown==3.7
Jinja2==3.1.6
-jinja-markdown==1.210911
+Markdown==3.7