Skip to content

Commit

Permalink
Update md_mermaid.py
Browse files Browse the repository at this point in the history
fix long-known bug during dealing with unicode which has puzzled and effected some projects. You may find the detail in oruelle#2. Why I leave two `new_lines.append(line)`? Because in oruelle#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.
  • Loading branch information
retsyo committed Dec 23, 2023
1 parent 692428c commit 9f5dd94
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions md_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<mermaid_sign>[\~\`]){3}[\ \t]*[Mm]ermaid[\ \t]*$")


Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 9f5dd94

Please sign in to comment.