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

@mostajs/doc-export

v0.1.1

Published

Orchestrateur Markdown → livrable paginé thémé (PDF A4, diaporama 16:9 PDF/PPTX, HTML autonome), zéro dépendance, sans build. Compose @mostajs/markdown-html (md→HTML) et @mostajs/palette (thèmes) ; les moteurs de rendu (Chrome headless, Electron printToPD

Readme

@mostajs/doc-export

Auteur : Dr Hamid MADANI [email protected] Licence : AGPL-3.0-or-later · Niveau : N2 (compose) · Zéro dépendance, sans build

Orchestrateur Markdown → livrable paginé thémé : PDF (A4), diaporama (PDF/PPTX), HTML autonome. doc-export est volontairement mince : il compose @mostajs/markdown-html (md→HTML) et @mostajs/palette (thèmes), et délègue le rendu au meilleur moteur du monde (Playwright / Electron / WeasyPrint / Typst / pandoc) via un port RenderDriver injecté. Il ne réimplémente aucun moteur PDF (cf. docs/01-ETUDE-ETAT-ART).

Pourquoi ce module (ce que l'état de l'art ne donne pas)

  • Orchestration composable dans une app (servir un README en aide, exporter un rapport, une fiche).
  • Thèmes dérivés de @mostajs/palette — contrastes validés (pas de couleurs en dur).
  • RTL arabe natif · souveraineté AGPL · cœur zéro-dépendance.
  • Embarquement Electron zéro-binaire (webContents.printToPDF) — aucune solution mondiale ne le fait.

Install

npm i @mostajs/doc-export @mostajs/markdown-html
# + un driver de rendu selon le contexte (voir plus bas)

Exemple minimal — HTML autonome (aucun driver requis)

import { createDocExporter } from '@mostajs/doc-export'
import * as markdown from '@mostajs/markdown-html'   // port md→HTML (défaut)

const doc = createDocExporter({
  markdown: { toHtml: (md) => ({ html: markdown.mdToHtml(md).html }) },
})

const { html } = await doc.render({
  source: '# Bonjour\n\nUn **document** souverain.',
  format: 'html',            // 'pdf' | 'slides-pdf' | 'pptx' | 'html'
  theme:  'light',
})
// -> HTML autonome (CSS embarqué), prêt à écrire sur disque ou à servir.

PDF — brancher un driver (on adopte le meilleur moteur du monde)

import { createDocExporter } from '@mostajs/doc-export'
import * as markdown from '@mostajs/markdown-html'
import { electronPdfDriver } from '@mostajs/doc-driver-electron'  // 0 binaire dans une app Electron

const doc = createDocExporter({
  markdown: { toHtml: (md) => ({ html: markdown.mdToHtml(md).html }) },
  drivers:  { pdf: electronPdfDriver() },
})

await doc.render({ source, format: 'pdf', theme: 'light', out: 'sortie.pdf' })

| Contexte | Driver recommandé | |---|---| | Serveur, rendu chaud rapide | @mostajs/doc-driver-playwright (défaut serveur) | | Application Electron | @mostajs/doc-driver-electron (zéro binaire) | | PDF léger, CSS Paged strict, sans JS | @mostajs/doc-driver-weasyprint | | Typographie de référence | @mostajs/doc-driver-typst | | Diaporama PPTX | @mostajs/doc-driver-pandoc |

Diaporama

await doc.render({ source, format: 'slides-pdf', theme: 'slides-light', out: 'deck.pdf' })
// Chaque `---` (règle horizontale) devient une frontière de diapo (1 diapo = 1 page).

RTL arabe

lang/dir sont auto-détectés (nom *.ar.md ou contenu arabe) ; sinon fournis explicitement. Le dir est posé sur <body>, cible des règles RTL des thèmes.

API

createDocExporter({ markdown, theme?, drivers? }) -> { render(req) } render({ source, format?, theme?, lang?, dir?, title?, out? }) -> { html?, bytes?, out? } Helpers purs exportés : detectDir, injectSlideBreaks, assembleStandaloneHtml, esc.

Sauts de page (document)

Pour commencer une section sur une nouvelle page, poser le saut sur le titre<h2 style="page-break-before: always;">Titre</h2>jamais un <div> vide (page blanche sous Chromium). Détails : Entreprise/md2View/md2View-v2/docs/AUDIT-CSS.md.

Tests

npm test   # node test-scripts/unit/doc-export.test.mjs (@mostajs/mjs-unit)

Voir aussi

  • docs/00-CARTOGRAPHIE-ET-PROPOSITION.md — proposition (DEVRULES §4).
  • docs/01-ETUDE-ETAT-ART-doc-export.md — état de l'art mondial (DEVRULES §⓪ Phase 2 / §9 #1).