aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQrius <[email protected]>2025-04-22 08:47:44 +0200
committerQrius <[email protected]>2025-04-22 08:47:46 +0200
commite677a88f84c60c80f637e4320dbe5a330af1fd8e (patch)
tree465318a5ea6886c19dca7a16b8a00def11c252bd
parentf2c2588c60dfd091fbf661501f4c3ce8874814f4 (diff)
downloadskaldpress-e677a88f84c60c80f637e4320dbe5a330af1fd8e.tar.gz
skaldpress-e677a88f84c60c80f637e4320dbe5a330af1fd8e.zip
Add markdown extensions for table and fenced code
-rw-r--r--src/smp/builtins.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/smp/builtins.py b/src/smp/builtins.py
index 2fde231..b44cc23 100644
--- a/src/smp/builtins.py
+++ b/src/smp/builtins.py
@@ -6,6 +6,8 @@ import urllib.error
import urllib.parse
import datetime
import markdown
+from markdown.extensions.tables import TableExtension
+from markdown.extensions.fenced_code import FencedCodeExtension
from skaldpress.metadata_parser import extract_parse_yaml_metadata
from gfm import AutolinkExtension, TaskListExtension # type: ignore
from typing import Any
@@ -172,6 +174,8 @@ def smp_builtin_html_from_markdown(macro_processor, text, extensions=list()):
# Get rid of quoting, I don't remember why, but the rust implementation does it like this.
for _ in range(2):
text = macro_processor.process_input(text)
+ extensions.append(TableExtension())
+ extensions.append(FencedCodeExtension())
extensions.append(AutolinkExtension())
extensions.append(TaskListExtension(max_depth=2))
return markdown.markdown(text, extensions=extensions)