npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@illusions-lab/mdi-to-pdf

v2.0.32

Published

Render MDI (.mdi) documents to PDF

Downloads

4,949

Readme

@illusions-lab/mdi-to-pdf

Chromium layout adapter for Rust-rendered MDI HTML. renderHtmlToPdf() applies an export profile and asks Chromium for PDF bytes. It deliberately accepts HTML, not MDI source: syntax parsing and semantic HTML rendering stay in mdi-core.

Install

npm install @illusions-lab/mdi @illusions-lab/mdi-to-pdf
npx playwright install chromium

The Playwright browser must be installed on the host that creates PDFs.

import { renderHtml } from "@illusions-lab/mdi";
import { renderHtmlToPdf } from "@illusions-lab/mdi-to-pdf";

const pdf = await renderHtmlToPdf(renderHtml("# A Rust-owned document"));

mdiToPdf(mdast, profile) remains available for existing unified consumers, but new applications should use the Rust-HTML route above.

Electron and Web Chromium hosts

Use the browser-safe profile entry when the application already owns Chromium. It does not import Playwright, Node built-ins, or launch a browser.

import { prepareChromiumPrintProfile } from "@illusions-lab/mdi-to-pdf/profile";

const print = prepareChromiumPrintProfile(html, profile, sourceWritingMode);
// Load print.html into an Electron BrowserWindow or an iframe and print it.
// print.page has physical millimetre dimensions and margins.
// print.pageNumbers contains optional Chromium header/footer templates.

applyPdfProfile(html, resolvedProfile) is also exported from this entry for hosts that already resolve their profile. Browser hosts should use print.html for the shared CSS layout; page-number headers and footers remain host-specific.

What this package owns

MDI source → Rust parser + HTML renderer → Chromium layout → PDF bytes

Rust resolves the page size, margins, writing mode, type settings, and page number templates. This package owns the final host step: loading that prepared HTML in Chromium and requesting PDF bytes. It never receives MDI source and cannot make syntax, profile-validation, or semantic-rendering decisions.

Documentation