From 9f5dd9469b049bef92eeedeba48382bc965d087c Mon Sep 17 00:00:00 2001 From: retsyo Date: Sat, 23 Dec 2023 19:11:23 +0800 Subject: [PATCH] Update md_mermaid.py fix long-known bug during dealing with unicode which has puzzled and effected some projects. You may find the detail in https://github.com/oruelle/md_mermaid/issues/2. Why I leave two `new_lines.append(line)`? Because in https://github.com/oruelle/md_mermaid/issues/2, @rayalan says his app depends on leading space, as a result I can't judge what we should do exactly. However, lets fix this to let most of the projects runs without problem again. --- md_mermaid.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/md_mermaid.py b/md_mermaid.py index 69bfea4..7d309b8 100644 --- a/md_mermaid.py +++ b/md_mermaid.py @@ -16,9 +16,6 @@ import re import string -def strip_notprintable(myStr): - return ''.join(filter(lambda x: x in string.printable, myStr)) - MermaidRegex = re.compile(r"^(?P[\~\`]){3}[\ \t]*[Mm]ermaid[\ \t]*$") @@ -57,7 +54,7 @@ def run(self, lines): new_lines.append("") m_end = None elif in_mermaid_code: - new_lines.append(strip_notprintable(line).strip()) + new_lines.append(line) else: new_lines.append(line)