From 3d7418a4b6567fabce1b2cf54ea07abec26e5003 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 6 Dec 2022 14:37:18 +0000 Subject: [PATCH] Bookmark formatting --- markdown.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/markdown.py b/markdown.py index e7a976084..9f9e1c787 100644 --- a/markdown.py +++ b/markdown.py @@ -385,8 +385,10 @@ def markdown_to_html(markdown: str) -> str: for hsh, hashes in titles.items(): if line.startswith(hashes): + bookmark_str = line.lower().replace(' ', '-') line = line.replace(hashes, '').strip() - line = '<' + hsh + ' id="' + line + '">' + line + '\n' + line = '<' + hsh + ' id="' + bookmark_str + '">' + \ + line + '\n' ctr = -1 break html_str += line