diff --git a/spip2md/config.py b/spip2md/config.py index 5c5e65d..d84af5d 100644 --- a/spip2md/config.py +++ b/spip2md/config.py @@ -23,6 +23,7 @@ class Configuration: max_sections_export: int = 500 data_dir: str = "data" clear_output: bool = False + prepend_h1: bool = True def __init__(self, config_file: Optional[str] = None): if config_file is not None: diff --git a/spip2md/spipobjects.py b/spip2md/spipobjects.py index 019bc7e..7cda828 100644 --- a/spip2md/spipobjects.py +++ b/spip2md/spipobjects.py @@ -1,10 +1,11 @@ from os.path import basename, splitext -from re import I, S, compile +from re import I, compile from peewee import ModelSelect from slugify import slugify from yaml import dump +from config import config from converters import convert, link_document from database import ( SpipArticles, @@ -105,7 +106,7 @@ class Article(SpipArticles): def body(self) -> str: body: str = "" # Add the title as a Markdown h1 - if len(self.titre) > 0: + if len(self.titre) > 0 and config.prepend_h1: body += "\n\n# " + self.titre # If there is a text, add the text preceded by two line breaks if len(self.texte) > 0: