Releases: amitdevx/md2pdf
v0.1.6
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
--paperagainstA4,Letter, andLegal, cleanly rejecting unsupported inputs with exit code1instead 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
.mdextensions prior to same-file evaluation. Passing.txtfiles or binary files now safely halts with exit code2and a helpful usage message. - Clear stdin Guard: Explicitly intercepts pipe (
-) attempts with a cleanstdin input is not supportedmessage. - 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
h1NewPagebehavior tofalseto prevent unexpected pagination breaks, and exposed an explicit--h1-new-pageCLI flag. - Full CLI E2E Test Suite: Added
tests/cli/index.test.tscovering 11 distinct success, error, and flag validation paths.
Bug Fixes
- Flawless Installation Feedback: Bypassed npm
postinstalloutput suppression by explicitly streaming directly toprocess.stderr.write. Installing globally (npm install -g @amitdevx/md2pdf) now clearly broadcastsmd2pdf: 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 theEACCEScode and outputs actionable permission guidance (chmod 644 <file>) with exit code2. - 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
\\nto\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 wherepruneEmptyattempted to filter child text nodes inside anchor elements. - CI Workflow Order Fix: Fixed a GitHub Actions CI failure by running
npm run buildprior tonpm 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
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
.pdfto output paths if the user forgets. Explicitly prevents accidental overwriting of your source.mdfile if the input and output paths match. - Orphaned Flag Warnings: Safely alerts users if they pass sub-flags like
--toc-depthor--header-templatewithout their required parent flags (--toc,--header).
Bug Fixes:
- Playwright Installation Fix: Removed an unreliable global guard in the
postinstallscript to guarantee that Chromium binaries are downloaded consistently uponnpm update. - API Path Resolution: Fixed a severe
ENOENTcrash inconvert()(specificallymetadata.ts) where the tool couldn't locatepackage.jsonin bundleddist/environments vs. localts-node. - Frontmatter Hardening: Gracefully intercepts
YAMLExceptionparsing errors andpublish: falseskips with clean frontend warnings, completely eliminating massivejs-yamllibrary stack dumps. - TOC Depth Validation:
--toc-depthnow 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
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
postinstallscript to automatically download the required Playwright Chromium binaries (~150MB) when runningnpm install -g @amitdevx/md2pdf. - Dependency guard: The auto-installer will safely skip the download if
md2pdfis 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
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
h1tags orhrhorizontal 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
__dirnameresolution path bugs that affected testing environments. - Resolved a bug where passing
{ enabled: false }to header/footer configurations was incorrectly evaluated as truthy. - Prevented
h1auto-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)
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
--tocCLI flag ortoc: trueAPI configuration. - Configurable heading depth using
--toc-depthand custom section titles via--toc-title. - Automatically assigns stable, URL-safe ID anchors to all headings (
h1–h6) usingrehype-slug.
YAML Frontmatter & PDF Metadata
- Integrates
gray-matterfor parsing YAML frontmatter. - Utilizes
pdf-libto inject frontmatter properties (title,author,subject,keywords) directly into the final PDF document metadata. - Files containing
publish: falsein 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
ConvertOptionsandConvertResultAPI interfaces withtocconfigurations andPdfMetadataoverrides. - 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
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
--tocCLI flag ortoc: trueAPI configuration. - Configurable heading depth using
--toc-depthand custom section titles via--toc-title. - Automatically assigns stable, URL-safe ID anchors to all headings (
h1–h6) usingrehype-slug.
YAML Frontmatter & PDF Metadata
- Integrates
gray-matterfor parsing YAML frontmatter. - Utilizes
pdf-libto inject frontmatter properties (title,author,subject,keywords) directly into the final PDF document metadata. - Files containing
publish: falsein 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
ConvertOptionsandConvertResultAPI interfaces withtocconfigurations andPdfMetadataoverrides. - 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
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
Playwrightto drive Chromium for pixel-perfect PDF pagination, executing standard print-friendly CSS. - Unified Ecosystem: Fully integrated with
remarkandrehypefor reliable AST parsing and AST-to-HTML conversion. - Beautiful Typography & Layout: Integrated Google Fonts (
Interfor standard text andJetBrains Monofor code blocks). We've also included sophisticated CSS for proper wrapping of code blocks across PDF boundaries! - Native Syntax Highlighting: Integrated
shikiright 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
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
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/md2pdfRoadmap
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