项目作者: vimtaai

项目描述 :
CommonMark superset with the most widely used syntax extensions
高级语言: JavaScript
项目地址: git://github.com/vimtaai/extramark.git
创建时间: 2019-02-01T16:34:24Z
项目社区:https://github.com/vimtaai/extramark

开源协议:MIT License

下载


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:

  1. 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).

  1. const { parse, render } = require("extramark");
  2. parse("# Heading");
  3. // [Object] - AST of the Markdown code
  4. render("# Heading");
  5. // <h1>Heading</h1>

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

  1. const { parse, render } = ExtraMark;

CLI

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

  1. 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).

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

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

  1. extramark --help

Features

Contributing

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