Skip to content

Getting Started

When using the Node API, you can install the package into your project’s dependencies.

Terminal window
npm install mdnman

When using the MDNMan CLI, it is recommended to install globally.

Terminal window
npm install --global mdnman
simple.ts
import {
findMDNFile,
getHeader,
completeParse,
} from 'mdnman';
const file = await findMDNFile('foreach');
if (!file) return;
const header = getHeader(file);
if (!header) return;
const parsedFile = completeParse(file, header.slug, false);
console.log(parsedFile)

Invoke the MDNMan command line interface with the mdnman command.

Terminal window
mdnman
Usage: mdnman [options] [command]
MDN reference CLI
Options:
-h, --help display help for command
Commands:
js [options] <query> Search the MDN JavaScript reference library
html [options] <query> Search the MDN HTML reference library
css [options] <query> Search the MDN CSS reference library
interactive [options] Use prompts to search the entire MDN reference library
help [command] display help for command

A complete command with options would look like this.

Terminal window
mdnman interactive --output file --path ./my-mdn-doc.md