Verified Commit 3ded01f1 authored by Jakob Moser's avatar Jakob Moser
Browse files

Strip comments from Markdown

parent 2b3ec4fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
[project]
name = "coliverter"
version = "0.3.1"
version = "0.3.2"
authors = [
  { name="Jakob Moser", email="moser@cl.uni-heidelberg.de" },
]
+6 −3
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@ def _get_filter(name: str) -> Path:


ACTIVE_MARKDOWN_EXTENSIONS = ("autolink_bare_uris", "emoji", "task_lists")
PANDOC_OPTIONS = (
INPUT_OPTIONS = ("--strip-comments",)
OUTPUT_OPTIONS = (
    "--wrap=none",
    "--standalone",
    "--css=https://fachschaft.cl.uni-heidelberg.de/wp-content/themes/fscoli-next-master/typography.css",
@@ -51,9 +52,11 @@ def md_to_html(markdown: str) -> str:
    :return: The same text in HTML
    """
    document = pandoc.read(
        source=markdown, format=f"commonmark_x+{'+'.join(ACTIVE_MARKDOWN_EXTENSIONS)}"
        source=markdown,
        format=f"commonmark_x+{'+'.join(ACTIVE_MARKDOWN_EXTENSIONS)}",
        options=INPUT_OPTIONS,
    )

    _replace(document, TOC_PLACEHOLDER, _get_table_of_contents(document))

    return pandoc.write(document, format="html", options=PANDOC_OPTIONS)
    return pandoc.write(document, format="html", options=OUTPUT_OPTIONS)