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

xml2md-cli

v0.1.3

Published

This project converts XML documentation into Markdown using an XSLT (`xform-md.xslt`). It includes a Node.js CLI that walks files or directories, applies the XSLT, and writes `.md` files mirroring the input structure.

Readme

XML → Markdown Transformer

This project converts XML documentation into Markdown using an XSLT (xform-md.xslt). It includes a Node.js CLI that walks files or directories, applies the XSLT, and writes .md files mirroring the input structure.

Features

  • Faithful Markdown generation from the existing XML schema
  • Code examples rendered as fenced code blocks (language from example/@code when provided)
  • Headings, lists, tables, links, arguments/returns, properties, and methods mapped to Markdown
  • Directory recursion with --recurse
  • Output directory mirrors the source tree (only extension changes to .md)
  • Multiple transform engines for portability and correctness

Install

  • Requirements: Node.js 16+ (recommended), PowerShell (on Windows).
  • Install dependencies:
npm install

CLI Usage

xml2md <inputPath> -o <outDir> [--recurse|-r] [--xslt <xsltPath>] [--engine dotnet|xslt-processor|libxml2-wasm] [-v]
  • inputPath: XML file or directory containing .xml
  • -o, --out <dir>: Output root directory (required)
  • -r, --recurse|--recursive: Recurse into subdirectories when inputPath is a directory
  • --xslt <path>: Path to XSLT (default: ./xform-md.xslt)
  • --engine <name>: Choose transform engine (see Engines below)
  • -v, --verbose: Print extra details (like the XSLT path)
  • Shortcuts: --dotnet or --ps are aliases for --engine dotnet

Examples:

# Convert a single file
node bin/xml2md.js docs/topic.xml -o out/

# Convert a directory (non-recursive)
node bin/xml2md.js docs -o out/

# Convert a directory (recursive)
node bin/xml2md.js docs -o out/ -r

# Explicitly select engine
node bin/xml2md.js docs -o out/ -r --engine xslt-processor
node bin/xml2md.js docs -o out/ -r --engine libxml2-wasm
node bin/xml2md.js docs -o out/ -r --engine dotnet

# Using the bin alias (after npm install)
xml2md docs -o out -r

Engines

The CLI supports three engines to perform the XSLT transform. The default depends on your OS to maximize compatibility and avoid external dependencies.

  • dotnet (default on Windows)

    • Uses PowerShell and .NET System.Xml.Xsl.XslCompiledTransform
    • Full XPath/XSLT 1.0 support; robust for complex stylesheets
    • No external tools required beyond standard Windows/PowerShell
  • xslt-processor (default on macOS/Linux)

    • Pure Node.js library
    • Fast and easy to install
    • Note: Some environments have limited XPath axis support (e.g., @attribute axis). If you encounter XPath parse errors, switch to dotnet (on Windows) or try libxml2-wasm.
  • libxml2-wasm

    • WebAssembly port of libxml2/libxslt
    • Standards-compliant XPath/XSLT, but the Node API varies by version
    • Use if you prefer libxml2 semantics; otherwise prefer the defaults

You can override the default engine at any time with --engine.

Output Structure

  • The output directory mirrors the input path. For example:
    • docs/Argument/index.xmlout/Argument/index.md
  • Only the file extension changes from .xml to .md.

XSLT Notes (xform-md.xslt)

  • Headings: topic/name become # titles; sections/groups become ##/### as appropriate
  • Code samples: example elements render as fenced code blocks; language is taken from example/@code when present
  • Syntax/Prototype: Rendered as fenced code blocks
  • Lists: Custom list nodes and HTML-like ul/ol/li mapped to Markdown lists
  • Tables: Rendered as basic Markdown tables (row/col spans are not supported)
  • Links: Converted to Markdown links; See Also/Next sections mapped to bullets/inline
  • Callouts: warning, deprecated, obsolete, note, important, tip mapped to blockquotes
  • Arguments/Returns: Bullet lists with inline type info (e.g., `name (Type) [optional]`)

Troubleshooting

  • PowerShell error: Add-Type : The assembly 'System.Xml.Xsl' could not be found

    • The CLI no longer uses Add-Type. We instantiate .NET types directly; update and re-run with --engine dotnet.
  • XPath parse error mentioning attribute axis (e.g., topic/@parent) when using xslt-processor

    • Some builds lack full XPath axis support. Use --engine dotnet (Windows) or --engine libxml2-wasm.
  • ESM import error with libxml2-wasm

    • We use dynamic import() internally. If you still see errors, try --engine xslt-processor or --engine dotnet.
  • Paths with spaces

    • Quote paths on Windows: node bin/xml2md.js "SQL" -o "out" -r

Development

  • CLI source: bin/xml2md.js
  • Markdown stylesheet: xform-md.xslt
  • Package metadata: package.json

If you want different heading depths, table formatting, or argument/return display tweaks, open an issue or adjust xform-md.xslt accordingly.