Loading src/coliverter/steps/__init__.py 0 → 100644 +0 −0 Empty file added. src/coliverter/steps/md_to_html.py 0 → 100644 +28 −0 Original line number Diff line number Diff line import subprocess PANDOC_EXECUTABLE = "pandoc" ACTIVE_MARKDOWN_EXTENSIONS = ("autolink_bare_uris", "emoji", "task_lists") PANDOC_OPTIONS = ( f"--from=markdown+{'+'.join(ACTIVE_MARKDOWN_EXTENSIONS)}", "--to=html", "--wrap=none", ) def md_to_html(markdown: str) -> str: """ Use pandoc to convert the given Markdown string to an HTML string. :param markdown: A string containing text in Markdown :return: The same text in HTML """ result = subprocess.run( (PANDOC_EXECUTABLE, *PANDOC_OPTIONS), input=markdown, capture_output=True, text=True, check=True, ) return result.stdout Loading
src/coliverter/steps/md_to_html.py 0 → 100644 +28 −0 Original line number Diff line number Diff line import subprocess PANDOC_EXECUTABLE = "pandoc" ACTIVE_MARKDOWN_EXTENSIONS = ("autolink_bare_uris", "emoji", "task_lists") PANDOC_OPTIONS = ( f"--from=markdown+{'+'.join(ACTIVE_MARKDOWN_EXTENSIONS)}", "--to=html", "--wrap=none", ) def md_to_html(markdown: str) -> str: """ Use pandoc to convert the given Markdown string to an HTML string. :param markdown: A string containing text in Markdown :return: The same text in HTML """ result = subprocess.run( (PANDOC_EXECUTABLE, *PANDOC_OPTIONS), input=markdown, capture_output=True, text=True, check=True, ) return result.stdout