Skip to content

Releases: amitdevx/md2pdf

v0.1.6

29 Jun 13:36

Choose a tag to compare

Release Notes - v0.1.6

major resilience, validation, and transparency release resulting from an exhaustive live system audit. It addresses critical option handling, strict input validation, edge-case crashes, and CI pipeline reliability.

Features & Enhancements

  • Strict Paper Validation: Added strict runtime validation for --paper against A4, Letter, and Legal, cleanly rejecting unsupported inputs with exit code 1 instead of silently delegating invalid formats to Playwright.
  • Robust Margin Validation: Implemented comprehensive regex validation for all valid CSS units (mm, cm, in, px, pt, pc, em, rem, %), completely eliminating raw internal Playwright stack traces on invalid margin inputs.
  • Explicit .md Extension Guard: Added an explicit check for .md extensions prior to same-file evaluation. Passing .txt files or binary files now safely halts with exit code 2 and a helpful usage message.
  • Clear stdin Guard: Explicitly intercepts pipe (-) attempts with a clean stdin input is not supported message.
  • Engine Transparency & UX Warnings: Notifies the user via clean terminal warnings before automatically generating new parent directory trees (console.warn) and alerts the user when an existing PDF is about to be overwritten.
  • Absolute Paths on Success: Replaced ambiguous relative paths with fully resolved absolute paths in success messages, eliminating confusion when invoking from deep subdirectories.
  • Predictable Page Breaks: Changed the default h1NewPage behavior to false to prevent unexpected pagination breaks, and exposed an explicit --h1-new-page CLI flag.
  • Full CLI E2E Test Suite: Added tests/cli/index.test.ts covering 11 distinct success, error, and flag validation paths.

Bug Fixes

  • Flawless Installation Feedback: Bypassed npm postinstall output suppression by explicitly streaming directly to process.stderr.write. Installing globally (npm install -g @amitdevx/md2pdf) now clearly broadcasts md2pdf: Checking Chromium browser... and provides immediate confirmation when ready: md2pdf is ready! Run: md2pdf <file.md>.
  • EACCES Permission Handling: When encountering read-protected files (chmod 000), the CLI intercepts the EACCES code and outputs actionable permission guidance (chmod 644 <file>) with exit code 2.
  • Trailing Slash Guard: Passing a directory path with a trailing slash (e.g., -o /tmp/) is cleanly rejected, preventing the accidental creation of hidden dotfiles (/tmp/.pdf).
  • YAMLException Multiline Parsing: Corrected the regex split escape from \\n to \n, ensuring the CLI prints only the clean first line of YAML syntax errors.
  • Nested Table of Contents & pruneEmpty Fix: Refactored the TOC AST generator to emit a true, semantically nested <ul> tree rather than a flat list with CSS padding hacks. Also resolved a subtle runtime crash where pruneEmpty attempted to filter child text nodes inside anchor elements.
  • CI Workflow Order Fix: Fixed a GitHub Actions CI failure by running npm run build prior to npm run test, ensuring the compiled CLI binary is available for Vitest end-to-end tests in pristine runner environments.

Full Changelog: v0.1.5...v0.1.6

v0.1.5

29 Jun 11:08

Choose a tag to compare

Release Notes - v0.1.5

major polish and bug-fix release focused on CLI User Experience, robust error handling, and resolving edge-case crashes found in the wild.

Features & Enhancements:

  • Native Footnotes Restored: Fully resolved CSS selector bugs causing footnote backlinks to render incorrectly. Footnotes (with bidirectional links) are now fully supported out-of-the-box.
  • Friendly CLI Error UX: The CLI now catches almost all edge cases (missing files, providing directories instead of files, missing arguments) and provides clean, color-coded, human-readable hints instead of raw Node.js stack traces.
  • Auto-Extension & Safety: Automatically appends .pdf to output paths if the user forgets. Explicitly prevents accidental overwriting of your source .md file if the input and output paths match.
  • Orphaned Flag Warnings: Safely alerts users if they pass sub-flags like --toc-depth or --header-template without their required parent flags (--toc, --header).

Bug Fixes:

  • Playwright Installation Fix: Removed an unreliable global guard in the postinstall script to guarantee that Chromium binaries are downloaded consistently upon npm update.
  • API Path Resolution: Fixed a severe ENOENT crash in convert() (specifically metadata.ts) where the tool couldn't locate package.json in bundled dist/ environments vs. local ts-node.
  • Frontmatter Hardening: Gracefully intercepts YAMLException parsing errors and publish: false skips with clean frontend warnings, completely eliminating massive js-yaml library stack dumps.
  • TOC Depth Validation: --toc-depth now strictly validates integer inputs (1-6) and gracefully halts on garbage input.
  • Exit Code Normalization: Differentiated exit codes (USAGE, INPUT, CONFIG, DEPENDENCY, RENDER) for reliable CI and bash scripting.

Full Changelog: v0.1.4...v0.1.5

v0.1.4

29 Jun 07:38

Choose a tag to compare

md2pdf v0.1.4 (Hotfix)

This release addresses an issue where Playwright's Chromium browser dependency was not automatically installed upon a global installation of the package.

Fixes

  • Auto-install browser: Added a postinstall script to automatically download the required Playwright Chromium binaries (~150MB) when running npm install -g @amitdevx/md2pdf.
  • Dependency guard: The auto-installer will safely skip the download if md2pdf is installed locally as a project dependency to prevent bloated installations.
  • CLI UX improvements: If the browser binary is ever missing or deleted, the CLI will now catch the error gracefully and provide a clean, actionable command to fix it, rather than throwing a raw stack trace.

Full Changelog: v0.1.3...v0.1.4

v0.1.3-headers-footers

29 Jun 06:59

Choose a tag to compare

md2pdf v0.1.3

This release introduces comprehensive page-level layout controls, including running headers, footers, and automatic pagination features.

New Features

  • Running Headers and Footers: Inject custom HTML headers and footers with dynamic variables (e.g., page numbers, titles) via the CLI (--header, --footer) or the programmatic API.
  • Manual Page Breaks: Force page breaks anywhere in your markdown document using standard <!-- pagebreak --> HTML comments.
  • Automatic Page Breaks: Configure automatic page breaks before h1 tags or hr horizontal rules to ensure clean section boundaries.
  • Dynamic Margins: Automated margin expansion to safely accommodate running headers and footers without overlapping body content.
  • Metadata Propagation: Dynamic inference of PDF Creator strings and safer HTML escaping for document titles.

Bug Fixes

  • Fixed an issue where custom metadata fields could overwrite fallback frontmatter unpredictably during PDF injection.
  • Resolved ESM __dirname resolution path bugs that affected testing environments.
  • Resolved a bug where passing { enabled: false } to header/footer configurations was incorrectly evaluated as truthy.
  • Prevented h1 auto-page-breaks from incorrectly injecting a blank leading page at the very start of the document.

Maintenance

  • Added comprehensive visual regression test fixtures for multi-page rendering and header/footer consistency.
  • Removed outdated transitive types and strictly exported all internal public API interfaces (PdfMetadata).

Full Changelog: v0.1.2...v0.1.3

v0.1.2-toc-footnotes(hot-fix)

28 Jun 09:39

Choose a tag to compare

Release v0.1.2 - Document Structure & Metadata

This release introduces new features for document structure and metadata handling, focusing on Table of Contents generation, PDF metadata injection, and GFM footnotes support.

Key Features

Table of Contents Generation

  • Generates hyperlinked Table of Contents via --toc CLI flag or toc: true API configuration.
  • Configurable heading depth using --toc-depth and custom section titles via --toc-title.
  • Automatically assigns stable, URL-safe ID anchors to all headings (h1h6) using rehype-slug.

YAML Frontmatter & PDF Metadata

  • Integrates gray-matter for parsing YAML frontmatter.
  • Utilizes pdf-lib to inject frontmatter properties (title, author, subject, keywords) directly into the final PDF document metadata.
  • Files containing publish: false in frontmatter are correctly ignored.

Footnotes Support

  • Natively supports GitHub Flavored Markdown (GFM) footnotes with bidirectional backlinks.
  • Restyled footnote definitions to appear accurately at the document base with a smaller font and standard separator line.

Developer & Internal Improvements

  • Extended ConvertOptions and ConvertResult API interfaces with toc configurations and PdfMetadata overrides.
  • Added custom AST plugin (rehypeToc) for robust TOC generation.
  • Added new visual Golden Document fixtures (toc.md, metadata.md, footnotes.md) to the regression test suite.

Full Changelog: v0.1.1...v0.1.2

v0.1.1-toc-footnotes

28 Jun 09:26

Choose a tag to compare

Release v0.1.1 - Document Structure & Metadata

This release introduces new features for document structure and metadata handling, focusing on Table of Contents generation, PDF metadata injection, and GFM footnotes support.

Key Features

Table of Contents Generation

  • Generates hyperlinked Table of Contents via --toc CLI flag or toc: true API configuration.
  • Configurable heading depth using --toc-depth and custom section titles via --toc-title.
  • Automatically assigns stable, URL-safe ID anchors to all headings (h1h6) using rehype-slug.

YAML Frontmatter & PDF Metadata

  • Integrates gray-matter for parsing YAML frontmatter.
  • Utilizes pdf-lib to inject frontmatter properties (title, author, subject, keywords) directly into the final PDF document metadata.
  • Files containing publish: false in frontmatter are correctly ignored.

Footnotes Support

  • Natively supports GitHub Flavored Markdown (GFM) footnotes with bidirectional backlinks.
  • Restyled footnote definitions to appear accurately at the document base with a smaller font and standard separator line.

Developer & Internal Improvements

  • Extended ConvertOptions and ConvertResult API interfaces with toc configurations and PdfMetadata overrides.
  • Added custom AST plugin (rehypeToc) for robust TOC generation.
  • Added new visual Golden Document fixtures (toc.md, metadata.md, footnotes.md) to the regression test suite.

Full Changelog: v0.1.0...v0.1.1

v0.1.0-core-rendering

27 Jun 15:28

Choose a tag to compare

Release v0.1.0 - Core Engine & Rendering Foundation

We are thrilled to announce the first major milestone of md2pdf! Version 0.1.0 introduces our powerful, high-fidelity core rendering engine, establishing a robust foundation for beautiful Markdown-to-PDF generation.

Key Features

  • High-Fidelity Rendering Pipeline: Leverages Playwright to drive Chromium for pixel-perfect PDF pagination, executing standard print-friendly CSS.
  • Unified Ecosystem: Fully integrated with remark and rehype for reliable AST parsing and AST-to-HTML conversion.
  • Beautiful Typography & Layout: Integrated Google Fonts (Inter for standard text and JetBrains Mono for code blocks). We've also included sophisticated CSS for proper wrapping of code blocks across PDF boundaries!
  • Native Syntax Highlighting: Integrated shiki right into the parsing pipeline, rendering beautiful colored code blocks for 20+ languages out of the box (with graceful fallbacks for unknown languages).
  • GitHub Flavored Markdown (GFM): Natively supports rendering tables, strikethrough, and properly aligned task lists (no more double-bullets!).
  • Safe Local Image Embedding: Smartly encodes and transforms local image paths (even those with spaces!) into absolute file:// URIs so they reliably show up in your PDFs.
  • Golden Document Testing Suite: Shipped with our robust visual regression suite layout (the "Golden Documents") so we can guarantee future updates never silently break your layouts.

CLI Enhancements

  • Properly structured CLI using commander.
  • Informative and robust error and warning surfaces (e.g. CLI now warns you if a code language isn't recognized but still proceeds with rendering).

What's Next?

Next up in the pipeline, we are setting our sights on v0.2.0 & v0.3.0, which will introduce native Mermaid.js diagram rendering and KaTeX mathematical equations, taking your technical PDFs to the next level.

Thank you for exploring md2pdf!
– Amit Divekar

md2pdf v0.0.2

27 Jun 06:03

Choose a tag to compare

md2pdf v0.0.2

This release focuses on improving the project's foundation, packaging, and release workflow. No major user-facing features have been added; instead, this version prepares the project for future development and reliable distribution.

Improvements

  • Refined npm package structure
  • Improved package metadata
  • Updated project documentation
  • Added comprehensive README
  • Added CONTRIBUTING guidelines
  • Added CHANGELOG
  • Added MIT License
  • Improved repository organization
  • Added GitHub Actions CI workflow
  • Added automated npm publishing workflow
  • Improved TypeScript build configuration
  • Improved package exports
  • Improved CLI packaging
  • Cleaned project structure
  • Enhanced release process
  • Improved build validation
  • Improved developer experience

Packaging

  • Reduced published package contents
  • Improved publish configuration
  • Refined .gitignore
  • Improved build output
  • Better package metadata for npm

CI/CD

  • Automated build validation
  • Automated linting
  • Automated type checking
  • Automated testing
  • Automated npm publishing on GitHub Releases

Bug Fixes

  • Fixed GitHub Actions publishing workflow
  • Fixed Playwright CI environment
  • Fixed npm authentication workflow
  • Fixed package publishing configuration
  • Fixed release automation issues

What's Next

Development for upcoming releases will focus on expanding Markdown rendering capabilities, including:

  • Mermaid diagram rendering
  • KaTeX math support
  • Obsidian callouts
  • Wiki links
  • Theme system
  • Configuration support
  • Plugin architecture

Full Changelog: v0.0.1...v0.0.2

md2pdf v0.0.1

26 Jun 18:13

Choose a tag to compare

md2pdf v0.0.1

Initial public release of md2pdf.

Features

  • Convert Markdown to PDF
  • GitHub Flavored Markdown support
  • Syntax highlighting
  • Playwright-based PDF rendering
  • TypeScript implementation
  • CLI support
  • Library API
  • Cross-platform support

Installation

npm install -g @amitdevx/md2pdf

Roadmap

Future releases will add:

  • Mermaid support
  • KaTeX
  • Obsidian callouts
  • Wiki links
  • Themes
  • Plugin system

Full Changelog: https://github.com/amitdevx/md2pdf/commits/v0.0.1