summaryrefslogtreecommitdiff
path: root/src/generate_html.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2026-03-02 15:17:32 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2026-03-02 15:19:02 +1300
commite88199551b5d2beba0fbaa054d0f2209b66627c6 (patch)
tree0c7d528ed846521ff00e8d886b5993fb65f22c6a /src/generate_html.rs
parent35b89decebe3b55ae636bff09d922af08d2164cb (diff)
downloadtoaster-e88199551b5d2beba0fbaa054d0f2209b66627c6.zip
Sanitize heading names in table of contents
Heading names in the table of contents are now sanitised and fancified, so that quotes and em-dashes and the likes are shown properly.
Diffstat (limited to 'src/generate_html.rs')
-rw-r--r--src/generate_html.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs
index 60e956b..6887f37 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -129,7 +129,7 @@ pub fn get_table_of_contents(page: &Page) -> String {
toc.push_str(&format!("<li class='l1'><a href='#title'>{page_name}</a></li>\n"));
for heading in &page.headings {
- let name = &heading.name;
+ let name = sanitize_text(&heading.name.plain(), true);
let url = &heading.slug();
let class = match heading.level {
Level::Heading1 => "l1",