From d7ab785b17c44d518a8ee939fb5df561b9f44061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Faur=C3=A9?= Date: Wed, 17 May 2023 10:21:36 +0200 Subject: [PATCH] spip headings as h2 and article title as h1 --- spip2md/articles.py | 3 +++ spip2md/converter.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/spip2md/articles.py b/spip2md/articles.py index c6d2edd..a5409c8 100644 --- a/spip2md/articles.py +++ b/spip2md/articles.py @@ -89,6 +89,9 @@ class Article: def get_article(self) -> str: # Build the final article text article: str = "---\n" + self.get_frontmatter() + "---" + # Add the title as a Markdown h1 + if len(self.title) > 0: + article += "\n\n# " + self.title # If there is a caption, add the caption followed by a hr if len(self.caption) > 0: article += "\n\n" + self.caption + "\n\n***" diff --git a/spip2md/converter.py b/spip2md/converter.py index 144a16a..93d48a6 100644 --- a/spip2md/converter.py +++ b/spip2md/converter.py @@ -14,8 +14,7 @@ spip_to_markdown = ( ), ( # heading compile(r"\{\{\{ *(.*?) *\}\}\}", S | I), - r"# \1", - # r"## \1", + r"## \1", # Translate SPIP headings to h2 ), ( # strong compile(r"\{\{ *(.*?) *\}\}", S | I),