Bookmark links

main
Bob Mottram 2022-12-06 14:48:57 +00:00
parent 98366a17de
commit 0d9c5d888b
1 changed files with 10 additions and 4 deletions

View File

@ -198,10 +198,16 @@ def _markdown_replace_links(markdown: str) -> str:
section_text = \
section_text.replace('!' + replace_str, html_link)
if replace_str in section_text:
if not link_url.startswith('#'):
# external link
html_link = \
'<a href="' + link_url + '" target="_blank" ' + \
'rel="nofollow noopener noreferrer">' + \
link_text + '</a>'
else:
# bookmark
html_link = \
'<a href="' + link_url + '">' + link_text + '</a>'
section_text = \
section_text.replace(replace_str, html_link)
ctr += 1