commit bb85631fbe438b7dafe015a8e0ce0782ac36d1c4
parent 97200fa8021707ce60bb243d5f5e8aaf39a55296
Author: Amit Dutta <mail@amit.is-a.dev>
Date: Tue, 28 Jul 2026 17:45:04 +0530
Merge pull request #16 from notamitgamer/edit-20260728-174406
fixed hyperlink issue
Diffstat:
| M | md.py | | | 17 | ++++++++++++++--- |
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/md.py b/md.py
@@ -80,6 +80,17 @@ def format_author(author: str) -> str:
return f"[{name}](mailto:{email})"
return esc_html(author)
+def format_author_html(author: str) -> str:
+ """Return an HTML <a> mailto link if the author string contains an email.
+ Use this instead of format_author() inside single-line raw HTML blocks
+ like <div>...</div>, since markdown syntax isn't parsed inside inline HTML."""
+ m = re.search(r'(.*?)\s*<(.*?)>', author)
+ if m:
+ name = esc_html(m.group(1).strip())
+ email = esc_html(m.group(2).strip())
+ return f'<a href="mailto:{email}">{name}</a>'
+ return esc_html(author)
+
def parse_c_style(content):
lines = content.splitlines()
n = len(lines)
@@ -363,14 +374,14 @@ def build_md(filename, lang_label, fence_lang, author, date, repo, license_str,
meta_parts = []
if author:
- meta_parts.append(format_author(author))
+ meta_parts.append(format_author_html(author))
if date:
meta_parts.append(esc_html(date))
-
+
if meta_parts:
body += [
f'<div style="font-size:0.8rem;color:var(--vp-c-text-3);margin-bottom:16px;">'
- f'{" • ".join(meta_parts)}</div>',
+ f'{" · ".join(meta_parts)}</div>',
"",
]