gitmyhub

ReLaXed

JavaScript ★ 12k updated 9mo ago

Create PDF documents using web technologies

ReLaXed converts Pug or plain HTML files into polished PDFs using a headless browser, letting you style documents with CSS frameworks and JavaScript libraries instead of learning LaTeX.

JavaScriptNode.jsPuppeteerChromiumPugMathJaxVega-LiteMermaidsetup: easycomplexity 2/5

ReLaXed is a command-line tool that generates PDF documents from source files written in Pug (a shorthand HTML syntax) or plain HTML. You write your content in a text file, run the tool, and it produces a PDF by rendering the page in a headless browser and capturing the output. It was built for people who want the precision of a markup language but also want access to the full range of modern web styling and layout capabilities.

The motivation behind the project is that standard Markdown is too limited for complex document layouts, while LaTeX has steep learning requirements and obscure error messages. Web technologies offer a practical alternative: CSS frameworks can handle clean typography and page structure, JavaScript libraries cover everything from math rendering to charting, and millions of people already know how these tools work. ReLaXed uses Pug as its preferred input format because it is a compact, readable way to write HTML.

Once installed via npm, the tool is invoked from a terminal with the source file as the argument. It then watches the file and any files in its directory, regenerating the PDF automatically each time something changes. A one-shot mode is also available for environments where file watching is not needed.

The repository includes example outputs: books, resumes, business cards, slides, research papers, and posters. Built-in support covers Markdown content blocks, math equations through MathJax, CSV files converted into HTML tables, charts through Vega-Lite and Chart.js, and diagrams through Mermaid. Any additional JavaScript or CSS library can be imported directly in the Pug file, so the feature set is not fixed to what the tool ships with.

ReLaXed uses Puppeteer under the hood to control the Chromium browser, which handles the actual rendering and PDF export.

Where it fits