Mdbook: top level heading clashes with separators

⚓ Rust    📅 2026-01-02    👤 surdeus    👁️ 1      

surdeus

On mdbook, we can do this for SUMMARY.md:

# Summary

# Common <!-- This is a separator-->
- [Article 1](path1.md)
- [Article 2](path2.md)
- [Article 3](path3.md)

#Summary is ignored, I just added it because it's useful to avoid linters complaining.

Since each article is a webpage, it seems to me most appropriate to have # to start each page, so for example path1.md would be:

# Article 1
...

Now there is a problem, we have the # Common separator and the # Article 1 which seems incorrect. Linters will complain since we have multiple h1s in that case.

A possible solution is just using ## Article 1 but now, in the case someone uses a screen reader, the top level header will be missing, and I would prefer to have that correctly.

All in all, it seems I should not have section separators, but they are useful.

Another way would be to hack the way the ToC is generated, but seems too much effort.

Any suggestions?

2 posts - 1 participant

Read full topic

🏷️ Rust_feed