$ show ggrossetie/asciidoctor-web-pdf
Asciidoctor Web PDF is a CLI tool that converts AsciiDoc documents to PDF using web technologies. It employs a multi-stage pipeline: Asciidoctor converts .adoc to HTML, Puppeteer renders the HTML via the Vivliostyle Viewer (CSS paged media), and pdf-lib adds PDF outline/bookmarks and metadata. The architecture features clean separation of concerns with dedicated modules for browser management, MathJax processing, syntax highlighting, outline generation, and metadata injection. Notable for its sophisticated handling of Node.js SEA binary execution paths and server-side MathJax rendering with proper async font loading.
The LLM identified 5 files worth highlighting for reuse:
Manages Puppeteer browser lifecycle with special handling for Node.js Single Executable Applications (SEA). Solves the non-obvious problem of resolving Chromium executable paths in SEA binaries where standard puppeteer.executablePath() fails due to baked-in build machine paths. Uses @puppeteer/browsers to compute paths relative to the binary instead.
Implements server-side MathJax 4 rendering for TeX and AsciiMath expressions. Notably handles the asynchronous loading of MathJax font variants (e.g., \mathscr requires 'script' variant) by using promise-based APIs (tex2chtmlPromise/asciimath2chtmlPromise) instead of synchronous ones, avoiding common 'MathJax retry -- an asynchronous action is required' errors.
Generates PDF bookmarks from AsciiDoc section headings. Specifically addresses Vivliostyle's encoded PDF named destinations (which exceed PDF spec limits) by resolving them to explicit destinations and removing the oversized /Dests name dictionary, preventing PDF validator warnings about excessive name token lengths.
Solves a critical PDF specification compliance issue where Vivliostyle's named destination encoding creates name tokens exceeding the 127-byte limit. Resolves all named destination references (in outline/bookmarks and inline links) to explicit destinations, then removes the problematic /Dests name dictionary from the PDF output.
Injects standard PDF metadata (title, author, subject, keywords, etc.) with special support for reproducible builds. When the 'reproducible' attribute is set, fixes creation/modification dates to Unix epoch (1970-01-01) ensuring bit-for-bit identical output across builds.