# markup-it

> Pipeline for working with markup input (for example Markdown)

Latest version **13.0.0** (published 2021-03-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install markup-it
pnpm add markup-it
yarn add markup-it
bun add markup-it
```

Provides the commands `markup-lint`, `markup-toHTML`, `markup-toJSON`, `markup-toMarkdown`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 13.0.0 |
| Published | 2021-03-19 |
| First published | 2016-04-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 22 |
| Unpacked size | 224.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 274 |
| Author | Samy Pesse |
| Maintainers | gitbook-bot, samypesse, jpreynat, aymeric-gb, emmerich |
| Keywords | slate, markdown, gitbook |

## Links

- npm: https://www.npmjs.com/package/markup-it
- Repository: https://github.com/GitbookIO/markup-it
- Homepage: https://github.com/GitbookIO/markup-it#readme
- Issues: https://github.com/GitbookIO/markup-it/issues
- npm.io page: https://npm.io/package/markup-it

## Dependencies (22)

- [is](https://npm.io/package/is.md) ^3.3.0
- [uid](https://npm.io/package/uid.md) ^0.0.2
- [html](https://npm.io/package/html.md) ^1.0.0
- [jest](https://npm.io/package/jest.md) ^26.6.3
- [ltrim](https://npm.io/package/ltrim.md) ^1.0.0
- [rtrim](https://npm.io/package/rtrim.md) ^1.0.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.13.1
- [warning](https://npm.io/package/warning.md) ^4.0.3
- [entities](https://npm.io/package/entities.md) ^2.0.0
- [htmlclean](https://npm.io/package/htmlclean.md) ^3.0.8
- [babel-jest](https://npm.io/package/babel-jest.md) ^26.6.3
- [trim-right](https://npm.io/package/trim-right.md) ^1.0.1
- [htmlparser2](https://npm.io/package/htmlparser2.md) ^4.0.0
- [split-lines](https://npm.io/package/split-lines.md) ^2.0.0
- [front-matter](https://npm.io/package/front-matter.md) ^3.1.0
- [indent-string](https://npm.io/package/indent-string.md) ^3.2.0
- [trim-newlines](https://npm.io/package/trim-newlines.md) ^3.0.0
- [detect-newline](https://npm.io/package/detect-newline.md) ^2.1.0
- [is-absolute-url](https://npm.io/package/is-absolute-url.md) ^3.0.3
- [trim-trailing-lines](https://npm.io/package/trim-trailing-lines.md) ^1.1.2
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^2.0.0
- [@gitbook/slate-hyperprint](https://npm.io/package/@gitbook/slate-hyperprint.md) ^2.3.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 13.0.0 (latest) — 2021-03-19
- 6.0.0-pre.1 (pre) — 2018-02-25
- 12.1.1 — 2020-05-27
- 12.1.0 — 2020-01-31
- 12.0.5 — 2020-01-24
- 12.0.4 — 2020-01-24
- 12.0.3 — 2020-01-17
- 12.0.2 — 2020-01-17
- 12.0.1 — 2019-12-09
- 12.0.0 — 2019-11-26
- 11.1.8 — 2019-07-15
- 11.1.7 — 2019-07-15
- 11.1.6 — 2019-06-19
- 11.1.5 — 2019-06-04
- 11.1.4 — 2019-02-27
- … 79 more at https://npm.io/package/markup-it/versions

## README

# markup-it

[![Build Status](https://travis-ci.org/GitbookIO/markup-it.svg?branch=master)](https://travis-ci.org/GitbookIO/markup-it)
[![NPM version](https://badge.fury.io/js/markup-it.svg)](http://badge.fury.io/js/markup-it)

`markup-it` is a JavaScript library to serialize/deserialize markdown content using an intermediate format backed by an immutable model.


### Installation

```
$ npm i markup-it --save
```

or

```
$ yarn add markup-it
```

### Usage

#### Parse markdown

```js
const { State, MarkdownParser } = require('markup-it');

const state = State.create(MarkdownParser);
const document = state.deserializeToDocument('Hello **World**');
```

#### Render document to HTML

```js
const { State, HTMLParser } = require('markup-it');

const state = State.create(HTMLParser);
const str = state.serializeDocument(document);
```

#### Render document to Markdown

```js
const { State, MarkdownParser } = require('markup-it');

const state = State.create(markdown);
const str = state.serializeDocument(document);
```

### ES6

`markup-it` is [ESM](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) compliant through the package.json `module` field, so you can safely use it with ES6 syntax for tree-shaking.

```js
import { State, HTMLParser } from 'markup-it';

const state = State.create(HTMLParser);
const str = state.serializeDocument(document);
```

### Testing

There are many scripts available in the `/bin` folder to output an HTML or Markdown file to multiple formats (HTML, Hyperscript, JSON, Markdown, YAML).

These scripts can be called with `babel-node`, for example:

```
babel-node bin/toJSON.js ./page.md
```

---
_Source: https://npm.io/package/markup-it · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
