summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-05-21 19:48:07 +1200
committerBen Bridle <ben@derelict.engineering>2025-05-21 19:50:09 +1200
commit24bc3c6bd64be8ed84ae3aff75cf9f2901214555 (patch)
tree863b2cfc28deb44c07baf2fb060fb623bcc4cf3b
parentfb9b3dfdd3d9edce96ca6f61b00d241f0429462b (diff)
downloadtoaster-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.
-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 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");