Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vimtaai/extramark
CommonMark superset with the most widely used syntax extensions
https://github.com/vimtaai/extramark
commonmark commonmark-superset markdown
Last synced: 16 days ago
JSON representation
CommonMark superset with the most widely used syntax extensions
- Host: GitHub
- URL: https://github.com/vimtaai/extramark
- Owner: vimtaai
- License: mit
- Created: 2019-02-01T16:34:24.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T23:50:14.000Z (about 2 months ago)
- Last Synced: 2024-11-07T01:45:45.780Z (about 1 month ago)
- Topics: commonmark, commonmark-superset, markdown
- Language: JavaScript
- Size: 173 KB
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - vimtaai/extramark - CommonMark superset with the most widely used syntax extensions (JavaScript)
README
# ExtraMark
[![Version][badge-version]](https://npmjs.com/package/extramark)
[![License][badge-license]](https://github.com/vimtaai/extramark/blob/master/LICENSE.md)
[![Code style][badge-style]](https://github.com/prettier/prettier)> CommonMark superset with the most widely used syntax extensions
**ExtraMark** is a superset of [CommonMark](https://commonmark.org/) 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](https://github.com/markdown-it/markdown-it) and uses plugins for syntax extensions.
## Installation
Install via `npm`:
```bash
npm install extramark
```Load from a CDN:
```html
```
## 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](https://github.com/markdown-it/markdown-it)).
```js
const { parse, render } = require("extramark");parse("# Heading");
// [Object] - AST of the Markdown coderender("# Heading");
//Heading
```In a browser environment you can access the `parse()` and `render()` functions via the `ExtraMark` global object.
```js
const { parse, render } = ExtraMark;
```### CLI
To transform documents in the command line you have to install the `extramark` package globally.
```bash
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`).
```bash
extramark input.md -o output.html -c style.css
```To see all options of the `extramark` see it's help:
```bash
extramark --help
```### Features
- Defined clearly as a superset of CommonMark
- Syntax extensions
- [Automatic typographic replacements][typographer]
- [Tables][table]
- [Anchors for headings][anchor] (up to heading level 3)
- [Definition lists][deflist]
- [Superscript][superscript]
- [Subscript][subscript]
- [Abbreviations][abbreviation]
- [Footnotes][footnote]
- [Critic Markup][critic-markup]
- Integrated CLI tool for command-line conversion to HTML[typographer]: https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
[table]: https://help.github.com/articles/organizing-information-with-tables/
[anchor]: https://github.com/valeriangalliat/markdown-it-anchor
[deflist]: https://github.com/markdown-it/markdown-it-deflist
[superscript]: https://github.com/markdown-it/markdown-it-sup
[subscript]: https://github.com/markdown-it/markdown-it-sub
[abbreviation]: https://github.com/markdown-it/markdown-it-abbr
[footnote]: https://github.com/markdown-it/markdown-it-footnote
[critic-markup]: http://criticmarkup.com/## Contributing
All ideas, recommendations, bug reports, pull requests are welcome. :smile:
[badge-version]: https://img.shields.io/npm/v/extramark.svg?style=flat-square
[badge-license]: https://img.shields.io/npm/l/extramark.svg?style=flat-square
[badge-style]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square