Skip to content

Commit

Permalink
fix: multiple links in tag (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivorc authored Feb 25, 2024
1 parent 4a52108 commit 5bc9898
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mkdocs_link_marker_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def __init__(self):

def on_page_content(self, html, page, config, files):
if self.config['enable_external_link']:
p_external_link = re.compile('<a href="(http.*)">(.*)</a>')
p_external_link = re.compile('<a href="(http.*?)">(.*?)</a>')
html = p_external_link.sub('<a href="\\1">\\2 ' + self.config['icon_external_link'] + '</a>', html)

if self.config['enable_mail']:
p_mail = re.compile('<a href="(mailto:.*)">(.*)</a>')
p_mail = re.compile('<a href="(mailto:.*?)">(.*?)</a>')
html = p_mail.sub('<a href="\\1">\\2 ' + self.config['icon_mail'] + '</a>', html)

return html

0 comments on commit 5bc9898

Please sign in to comment.