diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-05-21 19:48:07 +1200 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-05-21 19:50:09 +1200 |
commit | 24bc3c6bd64be8ed84ae3aff75cf9f2901214555 (patch) | |
tree | 863b2cfc28deb44c07baf2fb060fb623bcc4cf3b /src | |
parent | fb9b3dfdd3d9edce96ca6f61b00d241f0429462b (diff) | |
download | toaster-24bc3c6bd64be8ed84ae3aff75cf9f2901214555.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/generate_html.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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("<details><summary></summary><ul>\n"); |