Skip to content

CommonMark superset with the most widely used syntax extensions

License

Notifications You must be signed in to change notification settings

vimtaai/extramark

Repository files navigation

ExtraMark

Version License Code style

CommonMark superset with the most widely used syntax extensions

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

Load from a CDN:

<script src="https://cdn.jsdelivr.net/npm/extramark"></script>

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. 😄

About

CommonMark superset with the most widely used syntax extensions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published