Skip to content
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gcp/website/frontend_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,9 @@ def sort_versions(versions: list[str], ecosystem: str) -> list[str]:
# with
# <a href="https://chromium.googlesource.com/v8/v8.git/+/refs/heads/beta">
_URL_MARKDOWN_REPLACER = re.compile(r'(<a href=\".*?)(/ /)(.*?\">)')
_ANCHOR_TAG_REPLACER = re.compile(
r'<a\s+[^>]*name=["\'][^"\']*["\'][^>]*>\s*</a>|<a\s+[^>]*name=["\'][^"\']*["\'][^>]*/>',
re.IGNORECASE)


@blueprint.app_template_filter('markdown')
Expand All @@ -852,6 +855,9 @@ def markdown(text):
# space rather than %2B
# See: https://github.com/trentm/python-markdown2/issues/621
md = _URL_MARKDOWN_REPLACER.sub(r'\1/+/\3', md)
# Removes empty anchor tags that cause visual artifacts in rendered markdown
# See: https://github.com/google/osv.dev/issues/4237
md = _ANCHOR_TAG_REPLACER.sub('', md)

return md

Expand Down
Loading