spip headings as h2 and article title as h1
This commit is contained in:
parent
cd8febda2d
commit
d7ab785b17
@ -89,6 +89,9 @@ class Article:
|
|||||||
def get_article(self) -> str:
|
def get_article(self) -> str:
|
||||||
# Build the final article text
|
# Build the final article text
|
||||||
article: str = "---\n" + self.get_frontmatter() + "---"
|
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 there is a caption, add the caption followed by a hr
|
||||||
if len(self.caption) > 0:
|
if len(self.caption) > 0:
|
||||||
article += "\n\n" + self.caption + "\n\n***"
|
article += "\n\n" + self.caption + "\n\n***"
|
||||||
|
@ -14,8 +14,7 @@ spip_to_markdown = (
|
|||||||
),
|
),
|
||||||
( # heading
|
( # heading
|
||||||
compile(r"\{\{\{ *(.*?) *\}\}\}", S | I),
|
compile(r"\{\{\{ *(.*?) *\}\}\}", S | I),
|
||||||
r"# \1",
|
r"## \1", # Translate SPIP headings to h2
|
||||||
# r"## \1",
|
|
||||||
),
|
),
|
||||||
( # strong
|
( # strong
|
||||||
compile(r"\{\{ *(.*?) *\}\}", S | I),
|
compile(r"\{\{ *(.*?) *\}\}", S | I),
|
||||||
|
Loading…
Reference in New Issue
Block a user