
Security News
minimatch Patches 3 High-Severity ReDoS Vulnerabilities
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.
A CLI tool to convert Markdown files to PDF with support for math formulas, Mermaid diagrams, and syntax highlighting
A command-line tool that converts Markdown files to PDF with support for math formulas, Mermaid diagrams, and syntax highlighting. Designed for creating single-page PDFs optimized for e-ink devices and technical documentation.
npm install -g gfm-pdf
npm install gfm-pdf
gfm-pdf input.md
This will convert input.md to input.pdf in the same directory.
gfm-pdf input.md -o output.pdf
gfm-pdf document.md \
--output ./dist/document.pdf \
--theme monokai \
--format A4 \
--margins "1in" \
--css ./custom-styles.css \
--verbose
| Option | Short | Description | Default |
|---|---|---|---|
--output <path> | -o | Output PDF file path | {input}.pdf |
--theme <theme> | -t | Syntax highlighting theme | github |
--format <format> | -f | Page format (A4, A3, Letter, Legal, Singular) | Singular |
--margins <margins> | -m | Page margins in CSS format | 1cm |
--css <path> | Custom CSS file path | ||
--no-math | Disable math formula support | ||
--no-mermaid | Disable Mermaid diagram support | ||
--no-syntax | Disable syntax highlighting | ||
--verbose | -v | Enable verbose output | false |
Supports both inline and display math using KaTeX syntax:
Inline math: $E = mc^2$
Display math:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$
Math in code blocks:
```math
price = \max(unitPrice, 1e18)
collateralAmount = \frac{usdAmount \times 10^{decimals}}{price}
```
Supports all Mermaid diagram types:
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Success]
B -->|No| D[Retry]
```
```mermaid
sequenceDiagram
User->>API: Request
API-->>User: Response
```
Supports 100+ programming languages:
```javascript
function hello(name) {
console.log(`Hello, ${name}!`);
}
```
```python
def fibonacci(n):
return n if n <= 1 else fibonacci(n-1) + fibonacci(n-2)
```
You can customize the PDF appearance using a CSS file:
/* custom-styles.css */
body {
font-family: 'Georgia', serif;
line-height: 1.8;
color: #2c3e50;
}
h1, h2, h3 {
color: #34495e;
border-bottom: 2px solid #3498db;
padding-bottom: 0.3em;
}
pre {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 6px;
padding: 16px;
}
blockquote {
border-left: 4px solid #3498db;
margin: 0;
padding-left: 1em;
font-style: italic;
}
Then use it with:
gfm-pdf document.md --css custom-styles.css
The tool is specifically designed for e-ink devices with these optimizations:
gfm-pdf document.md \
--format A4 \
--margins "1.5cm" \
--theme github \
--output document.pdf
Perfect for converting technical docs with code examples, diagrams, and formulas:
gfm-pdf api-documentation.md \
--output ./docs/api-guide.pdf \
--theme vs-code-dark \
--format A4
Ideal for research papers with mathematical notation:
gfm-pdf research-paper.md \
--output paper.pdf \
--format Letter \
--margins "2cm" \
--theme github
Great for system design documents with Mermaid diagrams:
gfm-pdf system-design.md \
--output architecture.pdf \
--format A3 \
--verbose
"Input file does not exist"
"Playwright browser not found"
npx playwright install to install required browsersnpm installMath formulas not rendering
$ or $$)Mermaid diagrams not appearing
Custom CSS not applied
--verbose flag to monitor conversion progressgit clone https://github.com/arash16/gfm-pdf
cd gfm-pdf
npm install
npm run build
npm run dev input.md --output output.pdf
This project is licensed under the MIT License - see the LICENSE file for details.
Made with KosseKhari Methodologies ❤️ (Vibe Coding)
FAQs
A CLI tool to convert Markdown files to PDF with support for math formulas, Mermaid diagrams, and syntax highlighting
The npm package gfm-pdf receives a total of 6 weekly downloads. As such, gfm-pdf popularity was classified as not popular.
We found that gfm-pdf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.

Research
/Security News
Socket uncovered 26 malicious npm packages tied to North Korea's Contagious Interview campaign, retrieving a live 9-module infostealer and RAT from the adversary's C2.

Research
An impersonated golang.org/x/crypto clone exfiltrates passwords, executes a remote shell stager, and delivers a Rekoobe backdoor on Linux.