Skip to content

feat(pdf): Add pdfTocSource option to generate TOC from document head…#10995

Open
tsondergaard wants to merge 1 commit intodotnet:mainfrom
tsondergaard:10994-toc-from-headings
Open

feat(pdf): Add pdfTocSource option to generate TOC from document head…#10995
tsondergaard wants to merge 1 commit intodotnet:mainfrom
tsondergaard:10994-toc-from-headings

Conversation

@tsondergaard
Copy link

…ings

Add new configuration options to control PDF Table of Contents source:

  • pdfTocSource: 'toc' (default) or 'headings' to extract from document content
  • pdfTocHeadingDepth: maximum heading level to include (1-6, default 3)

When pdfTocSource is set to 'headings', the PDF TOC is generated by extracting h1-h6 headings from the rendered HTML pages instead of using the toc.yml structure. This is particularly useful for print-style publications using docfx for markdown-to-PDF generation, where the TOC should reflect the document's internal heading structure rather than website navigation.

Fixes #10994

@tsondergaard
Copy link
Author

@dotnet-policy-service agree

@tsondergaard
Copy link
Author

@yufeih, I see in the pull request history that you are the most active reviewer recently for this repo. Could you have a look at my PR or maybe point me to another suitable reviewer?

@tsondergaard tsondergaard force-pushed the 10994-toc-from-headings branch from 9ff6562 to dbee2b9 Compare February 21, 2026 11:07
…ings

Add new configuration options to control PDF Table of Contents source:
- pdfTocSource: 'toc' (default) or 'headings' to extract from document content
- pdfTocHeadingDepth: maximum heading level to include (1-6, default 3)

When pdfTocSource is set to 'headings', the PDF TOC is generated by
extracting h1-h6 headings from the rendered HTML pages instead of using
the toc.yml structure. This is particularly useful for print-style
publications using docfx for markdown-to-PDF generation, where the TOC
should reflect the document's internal heading structure rather than
website navigation.

Fixes dotnet#10994
@tsondergaard tsondergaard force-pushed the 10994-toc-from-headings branch from dbee2b9 to 9d6134e Compare February 23, 2026 17:48
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.

[Feature Request] Option to generate PDF Table of Contents from document headings

1 participant