feat(wiki): print view and export (PDF, ZIP, single-page HTML) #675

Closed
opened 2026-06-21 13:41:23 +00:00 by jmiller · 0 comments
Owner

Summary

Add wiki export and print capabilities — printable page view, PDF export, bulk ZIP download, and single-page HTML compilation. Similar to Wikipedia's "Download as PDF" and "Printable version" features.

Current State

  • No print-optimized view — printing a wiki page includes navigation chrome, sidebar, and footer
  • No export functionality for individual pages or the entire wiki
  • Wiki content is only accessible through the web UI or git clone

Design

1. Print View

  • Route: GET /:owner/:repo/wiki/:page?action=_print
  • Renders the wiki page without navigation, sidebar, header, or footer — content only
  • Print-optimized CSS: proper margins, page breaks, font sizing
  • "Print this page" button in the wiki page header

2. PDF Export (single page)

  • Route: GET /:owner/:repo/wiki/:page?action=_pdf
  • Server-side rendering of the markdown to PDF
  • Options: include/exclude ToC, include/exclude sub-pages
  • Implementation: render HTML → use a PDF library (wkhtmltopdf, chromedp, or pure Go like go-wkhtmltopdf)

3. Bulk Export (ZIP)

  • Route: GET /:owner/:repo/wiki?action=_export&format=zip
  • Downloads the entire wiki as a ZIP of markdown files (essentially a git archive of the wiki repo)
  • Alternative format: format=html — renders all pages to static HTML with relative links preserved

4. Single-Page HTML Compilation

  • Route: GET /:owner/:repo/wiki?action=_export&format=html-single
  • Compiles all wiki pages into a single HTML document with internal anchor links
  • Useful for offline reading or embedding wiki content in other systems

Files to Modify

File Change
routers/web/repo/wiki.go Print handler, PDF handler, export handlers
templates/repo/wiki/print.tmpl New — print-optimized template
templates/repo/wiki/view.tmpl Add print/export buttons to header
web_src/css/ Print stylesheet (@media print)

Wikipedia Parity

Wikipedia offers "Printable version", "Download as PDF", and book creator for compiling multiple articles. Export capabilities make wiki content portable and useful beyond the web UI.

## Summary Add wiki export and print capabilities — printable page view, PDF export, bulk ZIP download, and single-page HTML compilation. Similar to Wikipedia's "Download as PDF" and "Printable version" features. ## Current State - No print-optimized view — printing a wiki page includes navigation chrome, sidebar, and footer - No export functionality for individual pages or the entire wiki - Wiki content is only accessible through the web UI or git clone ## Design ### 1. Print View - **Route:** `GET /:owner/:repo/wiki/:page?action=_print` - Renders the wiki page without navigation, sidebar, header, or footer — content only - Print-optimized CSS: proper margins, page breaks, font sizing - "Print this page" button in the wiki page header ### 2. PDF Export (single page) - **Route:** `GET /:owner/:repo/wiki/:page?action=_pdf` - Server-side rendering of the markdown to PDF - Options: include/exclude ToC, include/exclude sub-pages - Implementation: render HTML → use a PDF library (wkhtmltopdf, chromedp, or pure Go like `go-wkhtmltopdf`) ### 3. Bulk Export (ZIP) - **Route:** `GET /:owner/:repo/wiki?action=_export&format=zip` - Downloads the entire wiki as a ZIP of markdown files (essentially a git archive of the wiki repo) - Alternative format: `format=html` — renders all pages to static HTML with relative links preserved ### 4. Single-Page HTML Compilation - **Route:** `GET /:owner/:repo/wiki?action=_export&format=html-single` - Compiles all wiki pages into a single HTML document with internal anchor links - Useful for offline reading or embedding wiki content in other systems ### Files to Modify | File | Change | |------|--------| | `routers/web/repo/wiki.go` | Print handler, PDF handler, export handlers | | `templates/repo/wiki/print.tmpl` | New — print-optimized template | | `templates/repo/wiki/view.tmpl` | Add print/export buttons to header | | `web_src/css/` | Print stylesheet (`@media print`) | ## Wikipedia Parity Wikipedia offers "Printable version", "Download as PDF", and book creator for compiling multiple articles. Export capabilities make wiki content portable and useful beyond the web UI.
jmiller added the feature: wiki label 2026-06-21 13:41:23 +00:00
Sign in to join this conversation.