Skip to content

Latest commit

 

History

History
88 lines (63 loc) · 3.13 KB

README.md

File metadata and controls

88 lines (63 loc) · 3.13 KB

ExtraMark

License Version

ExtraMark is a superset of CommonMark that includes syntax extensions that are commonly used by other Markdown dialects. The list and syntax for the extensions are decided by looking at the most popular Markdown dialects and selecting the most common syntax for each feature. The goal of the project is to create a (somewhat) standard superset of CommonMark that supports the features that are requested by most. The parser is based on markdown-it and uses plugins for syntax extensions.

Installation

Install via npm:

npm install extramark

Usage

The extramark package exposes two functions, parse() and render(). The parse() function creates an abstract syntax tree from the input while the render() function returns the generated HTML code (see markdown-it).

const { parse, render } = require("extramark");

parse("# Heading");
// [Object] - AST of the Markdown code

render("# Heading");
// <h1>Heading</h1>

In a browser environment you can access the parse() and render() functions via the ExtraMark global object.

const { parse, render } = ExtraMark;

CLI

To transform documents in the command line you have to install the extramark package globally.

npm install -g extramark

After the installation the extramark command becomes available. The command can be used to transform the input text (file or stdin) to HTML (file or stdout).

extramark input.md -o output.html -c style.css

To see all options of the extramark see it's help:

extramark --help

Features

Contributing

All ideas, recommendations, bug reports, pull requests are welcome. 🙂