Ajout d'un champ description au modèle Post avec migration associée, mise à jour des templates pour utiliser ce champ, et amélioration du formatage des commentaires Markdown avec gestion des titres typographiques.

This commit is contained in:
mrtoine 2025-12-15 21:29:26 +01:00
parent 43af8bd0d8
commit 4a48425374
6 changed files with 38 additions and 4 deletions

View file

@ -27,6 +27,19 @@ def _format_inline(text: str) -> str:
lambda m: f"<code class=\"comment-code\">{m.group(1)}</code>",
text,
)
# H1
text = re.sub(r"^# (.+)$", r"<h1>\1</h1>", text, flags=re.MULTILINE)
# H2
text = re.sub(r"^## (.+)$", r"<h2>\1</h2>", text, flags=re.MULTILINE)
# H3
text = re.sub(r"^### (.+)$", r"<h3>\1</h3>", text, flags=re.MULTILINE)
# H4
text = re.sub(r"^#### (.+)$", r"<h4>\1</h4>", text, flags=re.MULTILINE)
# H5
text = re.sub(r"^##### (.+)$", r"<h5>\1</h5>", text, flags=re.MULTILINE)
# H6
text = re.sub(r"^###### (.+)$", r"<h6>\1</h6>", text, flags=re.MULTILINE)
# bold **text**
text = re.sub(
r"\*\*([^*]+)\*\*",