spip headings as h2 and article title as h1

This commit is contained in:
Guilhem Fauré 2023-05-17 10:21:36 +02:00
parent cd8febda2d
commit d7ab785b17
2 changed files with 4 additions and 2 deletions

View File

@ -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***"

View File

@ -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),