Skip to content

Commit

Permalink
Fix the bug where backslashes wrapped in backticks cannot be rendered…
Browse files Browse the repository at this point in the history
… as markdown.
  • Loading branch information
yym68686 committed Jul 17, 2024
1 parent 747f03f commit 798634e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="md2tgmd",
version="0.2.8",
version="0.2.9",
description="md2tgmd is a Markdown to Telegram-specific-markdown converter.",
long_description=Path("README.md").open(encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
6 changes: 6 additions & 0 deletions src/md2tgmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def escape(text, flag=0):
text = re.sub(r"`", '\`', text)
text = re.sub(r"\@\<\@", '\`', text)
text = re.sub(r"\@\-\>\@", '`', text)
text = re.sub(r"\s`\\`\s", ' `\\\\\` ', text)

# text = replace_all(text, r"`.*?`{1,2}|(`)", escapebackquoteincode)
# text = re.sub(r"`", '\`', text)
Expand Down Expand Up @@ -264,6 +265,11 @@ def escape(text, flag=0):
(\`)
- `Path.open()` 方法打开了 `README.md` 文件,并指定了编码为 `"utf-8"`。
为了匹配实际的点号,需要使用反斜杠 `\` 进行转义。
3. `(`
'''

if __name__ == '__main__':
Expand Down

0 comments on commit 798634e

Please sign in to comment.