tact-docs icon indicating copy to clipboard operation
tact-docs copied to clipboard

CI: Auto-export docs to PDF

Open novusnota opened this issue 1 year ago • 0 comments

And provide links to the resulting files from the index page and from the sidebar.

Links to explore:

  • https://github.com/jean-humann/docs-to-pdf
  • https://github.com/simonhaenisch/md-to-pdf
  • https://github.com/withastro/starlight/discussions/964
  • https://www.npmjs.com/package/html-export-pdf-cli
  • https://wkhtmltopdf.org/
  • https://pandoc.org/

Rough implementation pipeline (steps 4-6 may be delegated to an existing solution, if any):

  1. A secondary build, which would change all the pages to have template: splash in the frontmatter (via a small remark plugin)
  2. Get a list and names of html pages from the sidebar property in astro.config.mjs
  3. Strip each .html file of the top bar and table of contents on the right
  4. Convert each .html file to .pdf individually, obtaining the number of pages occupied
  5. Then, construct table of contents using data from steps 3 and 4
  6. Finally, combine all individual .pdf pages into one big .pdf and place it into public/
  7. In the primary build, add the links to it onto the index page and from the sidebar (alternative solution would be to put them in the footer or top bar)

novusnota avatar Oct 01 '24 11:10 novusnota