diff --git a/common/markdown.py b/common/markdown.py deleted file mode 100755 index 30c5bc2c09..0000000000 --- a/common/markdown.py +++ /dev/null @@ -1,48 +0,0 @@ -from typing import List - -HTML_REPLACEMENTS = [ - (r'&', r'&'), - (r'"', r'"'), -] - - -def parse_markdown(text: str, tab_length: int = 2) -> str: - lines = text.split("\n") - output: List[str] = [] - list_level = 0 - - def end_outstanding_lists(level: int, end_level: int) -> int: - while level > end_level: - level -= 1 - output.append("") - if level > 0: - output.append("") - return end_level - - for i, line in enumerate(lines): - if i + 1 < len(lines) and lines[i + 1].startswith("==="): # heading - output.append(f"

{line}

") - elif line.startswith("==="): - pass - elif line.lstrip().startswith("* "): # list - line_level = 1 + line.count(" " * tab_length, 0, line.index("*")) - if list_level >= line_level: - list_level = end_outstanding_lists(list_level, line_level) - else: - list_level += 1 - if list_level > 1: - output[-1] = output[-1].replace("", "") - output.append("