From fb9b3dfdd3d9edce96ca6f61b00d241f0429462b Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 21 Mar 2025 14:44:28 +1300 Subject: Fix IDs generated for styled headings Headings that contained line elements other than Normal were being stringified with the line_to_html function, which was causing the generated ID for such a heading to contain HTML tags. This was fixed by instead stringifying using the basic to_string() method of Line. --- src/generate_html.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generate_html.rs b/src/generate_html.rs index 55bd8ef..806c4bc 100644 --- a/src/generate_html.rs +++ b/src/generate_html.rs @@ -112,7 +112,7 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs for block in &document.blocks { match block { Block::Heading { level, line } => { - let id = make_url_safe(strip_appendix(&line_to_html!(line))); + let id = make_url_safe(strip_appendix(&line.to_string())); match level { Level::Heading1 => tag!("h1", line, format!("id='{id}'")), Level::Heading2 => tag!("h2", line, format!("id='{id}'")), -- cgit v1.2.3-70-g09d2