Skip to content

feat: modularise toc part generation with variable padding length#369

Open
thompson-tomo wants to merge 7 commits into
thlorenz:masterfrom
thompson-tomo:content_generation
Open

feat: modularise toc part generation with variable padding length#369
thompson-tomo wants to merge 7 commits into
thlorenz:masterfrom
thompson-tomo:content_generation

Conversation

@thompson-tomo

Copy link
Copy Markdown
Contributor

This extracts the generation of the toc parts into the content generator module.

This extraction improves testability, functionality scoping & lays the foundation for enabling full control of padding before & after the content.

This approach enables control of the qty of padding before title etc.

@thompson-tomo thompson-tomo marked this pull request as ready for review June 26, 2026 10:50
@thompson-tomo thompson-tomo changed the title feat: modularise toc part generation feat: modularise toc part generation with variable padding length Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors TOC assembly by extracting TOC header/title/footer line generation into lib/content-generation.js, aiming to improve modularity and enable configurable padding around TOC parts.

Changes:

  • Moved TOC header/title/footer line construction into reusable helpers (tocHeader, tocTitle, tocFooter) in lib/content-generation.js.
  • Updated lib/transform.js to use the new content generator helpers and to centralize title options under options.toc.title.
  • Adjusted README.md documentation for TOC title padding.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
README.md Updates documentation around --toc-title-padding-before behavior/expectations.
lib/transform.js Switches TOC composition to use new content-generation helpers and updates title inference flow.
lib/content-generation.js Introduces helpers to generate TOC parts with padding and content selection logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/content-generation.js Outdated
Comment thread README.md
Comment thread lib/transform.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants