Closed NBonaparte closed 3 years ago
mdBook creates unique slugs for headings by appending -{n}, where n is the number of times a heading with the same name has appeared before:
-{n}
n
https://github.com/rust-lang/mdBook/blob/7af4b1dfe80903e3a2288355a2a396e7458866ee/src/renderer/html_handlebars/hbs_renderer.rs#L742-L764
This follows the same process to ensure the links match. I also optimized string handling to reduce allocations (using write!() instead of format!() + push()/push_str()), and also applied clippy fixes.
write!()
format!()
push()
push_str()
mdBook creates unique slugs for headings by appending
-{n}
, wheren
is the number of times a heading with the same name has appeared before:https://github.com/rust-lang/mdBook/blob/7af4b1dfe80903e3a2288355a2a396e7458866ee/src/renderer/html_handlebars/hbs_renderer.rs#L742-L764
This follows the same process to ensure the links match. I also optimized string handling to reduce allocations (using
write!()
instead offormat!()
+push()
/push_str()
), and also applied clippy fixes.