rust-lang / rust-lang/mdBook

Sub chapters as anchor links to the same chapter

Open
#2,979 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
22.2k
Forks
1.9k
PR merge metrics
PR metrics pending

Description

Problem

Currently if you want to have sub chapter that point to the same markdown as the chapter you get additional .md and .html files generated:

- [First Chapter](relative/path/to/markdown.md)
- [Second Chapter](relative/path/to/markdown2.md)
   - [Sub Chapter](relative/path/to/markdown2.md#sub-chapter)

The least we can do is not generate the html & md files and instead just point to the anchor link in summary.

I will take a look at mdbook code and see if I can open a PR regarding this.

Proposed Solution

No response

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how mdBook reads the SUMMARY.md links and generates output for links with anchors, then inspect the related Rust implementation and tests. Confirm the change with the example where a subchapter points to the same Markdown file, ensuring no extra .md or .html files are generated and the summary link targets the anchor.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, rust
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.