From 24bc3c6bd64be8ed84ae3aff75cf9f2901214555 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Wed, 21 May 2025 19:48:07 +1200 Subject: Change criteria for generating a table of contents Count level 3 headings when deciding whether there are enough headings on a page to justify generating a table of contents. Previously, only level 1 and 2 headings were being counted. --- 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 806c4bc..a6aa0b6 100644 --- a/src/generate_html.rs +++ b/src/generate_html.rs @@ -71,7 +71,7 @@ pub fn get_html_head(page: &Page, website: &Website) -> String { pub fn get_table_of_contents(page: &Page) -> String { - if page.headings.iter().filter(|h| h.level != Level::Heading3).count() < 3 { + if page.headings.len() < 3 { return String::new(); } let mut toc = String::from("