Skip to content

Add automatic chapter renumbering when chapters are reordered #3

@bob-duetto

Description

@bob-duetto

Feature Request

Description:
When reorganizing a book (moving, adding, or removing chapters), chapter numbers in titles need to be manually updated. This is error-prone and tedious.

Requested Feature:
Add a tool or option to automatically renumber chapters based on their position in SUMMARY.md. Options could include:

  1. A new MCP tool renumber_chapters that updates chapter title prefixes based on position
  2. An option in update_toc to also update chapter number prefixes in titles
  3. A chapter_numbering config option in book.toml that controls numbering format (e.g., "1.", "Chapter 1:", "1.1", etc.)

Use Case:
When writing a book, chapters frequently get reorganized. Currently, if I move Chapter 5 to position 3, I need to manually update:

  • The title in SUMMARY.md
  • The H1 heading in the chapter file
  • Any cross-references to that chapter

Suggested Implementation:

  • Parse SUMMARY.md for chapter order
  • Update H1 headings in chapter files to match position
  • Support configurable number formats (numeric, roman numerals, etc.)
  • Optionally update cross-references

Related:

  • Core mdbook doesn't support this either
  • Third-party preprocessors exist (mdbook-numbering, mdbook-chapter-number) but require separate installation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions