Skip to content

Add documentation export to single HTML and PDF files - #7081

Draft
peterkir with Copilot wants to merge 6 commits into
masterfrom
copilot/add-html-pdf-generation-options
Draft

Add documentation export to single HTML and PDF files#7081
peterkir with Copilot wants to merge 6 commits into
masterfrom
copilot/add-html-pdf-generation-options

Conversation

Copilot AI commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Enables exporting Bnd documentation to offline formats (single HTML or PDF) for archival, distribution, and offline access across different versions.

Implementation

Export scripts:

  • export-single-html.sh - Combines all Jekyll-generated pages into single HTML with embedded TOC and print-friendly CSS
  • export-pdf.sh - Converts to PDF using auto-detected tools (wkhtmltopdf > weasyprint > chromium), falls back to HTML with manual conversion instructions
  • export-release.sh - Exports from releases/ directory without requiring Jekyll rebuild

Content extraction:

  • Python HTMLParser extracts main content from multiple documentation structures:
    • Just-the-docs theme: <main id="main-content">
    • Legacy _site structure: <main data-pagefind-body>
    • Release structure: <div class="notes-margin">
  • Priority-based selection ensures accurate content extraction
  • Preserves document order: index, introduction, chapters, instructions, macros, commands, headers, tools, plugins
  • Handles nested HTML structures with depth tracking
  • Properly excludes navigation bars and sidebars in all structures

Documentation:

  • EXPORT_README.md - User guide with installation, usage, troubleshooting
  • USAGE_EXAMPLES.md - 10 practical examples covering all workflows
  • IMPLEMENTATION_SUMMARY.md - Technical details

Compatibility:

  • ✅ Just-the-docs Jekyll theme (current documentation)
  • ✅ Legacy custom Jekyll templates
  • ✅ Archived release documentation

Usage

# Export archived release (no build required)
./export-release.sh 7.0.0      # → bnd-docs-7.0.0.html (1.7 MB)
./export-release.sh 7.0.0 pdf  # → bnd-docs-7.0.0.pdf (995 KB)

# Export current development version
./build.sh
./export-single-html.sh master
./export-pdf.sh master

Tested with 7.0.0 release: 443 pages → 1.7MB HTML / 995KB PDF in <30s.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add options for creating HTML or PDF from docs Add documentation export to single HTML and PDF files Feb 3, 2026
Copilot AI requested a review from peterkir February 3, 2026 08:56
@peterkir

Copy link
Copy Markdown
Contributor

@copilot
Review the doc updates to Just-the-docs templates and assure that export still works and nav bar is considered in html and pdf exports.

Copilot AI commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot
Review the doc updates to Just-the-docs templates and assure that export still works and nav bar is considered in html and pdf exports.

I've updated the export scripts to support the Just-the-docs theme migration (commit fe3f10c).

Changes made:

  • Enhanced HTML parser to recognize Just-the-docs structure (<main id="main-content">)
  • Maintained backward compatibility with legacy templates and release documentation
  • Added priority-based content extraction for accurate parsing

Tested compatibility:
✅ Just-the-docs theme (current): <main id="main-content">
✅ Legacy _site structure: <main data-pagefind-body>
✅ Release documentation: <div class="notes-margin">

The navigation bar is properly excluded from exports in all structures - the parser specifically targets main content areas and ignores nav/sidebar elements.

@peterkir

peterkir commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@copilot
Review and validate that described tools and processes are still working
move the exports scripts and howtos to a separte subfolder _export
create a chapter inside documentation under "documentation and tools" describing how to use them - reuse created doc

Copilot AI and others added 6 commits June 5, 2026 10:14
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
@peterkir
peterkir force-pushed the copilot/add-html-pdf-generation-options branch from f81b8a7 to 704d465 Compare June 5, 2026 08:14
@peterkir

peterkir commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

https://gh.io/copilot-coding-agent-docs
Review and validate that described tools and processes are still working
move the exports scripts and howtos to a separate subfolder docs/_export
create a chapter inside documentation under "documentation and tools" describing how to use them - reuse created doc

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