Skip to content

Commit

Permalink
also fix multiple consecutive backticks & r"#\d" in the middle of words
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywright committed Feb 5, 2025
1 parent 60472bb commit 5092d64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion misc/gen_blog_post_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def convert(src: str) -> str:
h = format_code(h)

# Code fragments
h = re.sub(r"``([^`]+)``", r"<tt>\1</tt>", h)
h = re.sub(r"`([^`]+)`", r"<tt>\1</tt>", h)

# Remove **** noise
Expand All @@ -125,7 +126,9 @@ def convert(src: str) -> str:
r'fixes issue <a href="https://github.com/python/mypy/issues/\1">\1</a>',
h,
)
h = re.sub(r"#([0-9]+)", r'PR <a href="https://github.com/python/mypy/pull/\1">\1</a>', h)
# Note the leading space to avoid stomping on strings that contain #\d in the middle (such as
# links to PRs in other repos)
h = re.sub(r" #([0-9]+)", r'PR <a href="https://github.com/python/mypy/pull/\1">\1</a>', h)
h = re.sub(r"\) \(PR", ", PR", h)

# Markdown links
Expand Down

0 comments on commit 5092d64

Please sign in to comment.