# mark-twain

> Parse Markdown into JsonML.

Latest version **2.0.3** (published 2018-05-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install mark-twain
pnpm add mark-twain
yarn add mark-twain
bun add mark-twain
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2018-05-10 |
| First published | 2015-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 88 |
| Author | Benjy Cui |
| Maintainers | benjycui, paranoidjk |
| Keywords | markdown, yaml, parser, jsonml |

## Links

- npm: https://www.npmjs.com/package/mark-twain
- Repository: https://github.com/benjycui/mark-twain
- Homepage: https://github.com/benjycui/mark-twain#readme
- Issues: https://github.com/benjycui/mark-twain/issues
- npm.io page: https://npm.io/package/mark-twain

## Dependencies (3)

- [remark](https://npm.io/package/remark.md) ^5.0.1
- [jsonml.js](https://npm.io/package/jsonml.js.md) ^0.1.0
- [yaml-front-matter](https://npm.io/package/yaml-front-matter.md) ^4.0.0

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 2.0.3 (latest) — 2018-05-10
- 2.0.2 — 2017-06-12
- 2.0.1 — 2017-06-05
- 2.0.0 — 2017-06-05
- 1.1.6 — 2016-12-22
- 1.1.5 — 2016-07-20
- 1.1.4 — 2016-04-18
- 1.1.3 — 2016-04-11
- 1.1.2 — 2016-04-08
- 1.1.1 — 2016-04-06
- 1.1.0 — 2016-04-06
- 1.0.2 — 2016-04-01
- 1.0.1 — 2016-04-01
- 1.0.0 — 2016-04-01
- 1.0.0-beta.2 — 2016-04-01
- … 6 more at https://npm.io/package/mark-twain/versions

## README

# Mark Twain

[![](https://img.shields.io/travis/benjycui/mark-twain.svg?style=flat-square)](https://travis-ci.org/benjycui/mark-twain)
[![npm package](https://img.shields.io/npm/v/mark-twain.svg?style=flat-square)](https://www.npmjs.org/package/mark-twain)
[![NPM downloads](http://img.shields.io/npm/dm/mark-twain.svg?style=flat-square)](https://npmjs.org/package/mark-twain)
[![Dependency Status](https://david-dm.org/benjycui/mark-twain.svg?style=flat-square)](https://david-dm.org/benjycui/mark-twain)

It is not easy to process Markdown directly. However, we can use `mark-twain` to parse a Markdown file(and YAML/HTML which in it) into [JsonML](http://www.jsonml.org/) which is easier to process.

## Installation

```bash
npm install mark-twain
```

## Usage

```js
const MT = require('mark-twain');
const fs = require('fs');
const jsonML = MT(fs.readFileSync('something.md').toString());
```

The returned value of `MT` would be JsonML, something looks like this:

```js
{
  // YAML will be parsed as meta data.
  meta: {
    title: 'Title',
    ...
  },

  // Others will be parsed as JsonML.
  content:  [
    "article",
    ["h1", "Here is a heading"],
    [
      "ol",
      [
        "li",
        [
          "p",
          "First"
        ]
      ],
      ...
    ],
    [
      "p",
      "This is a paragraph, including ",
      [
        "em",
        "EM"
      ],
      " and ",
      [
        "strong",
        "STRONG"
      ],
      ". Any question? Oh, I almost forget ",
      [
        "code",
        "inline code"
      ],
      "."
    ],
    ...
  ]
}
```

## Relative

* [jsonml-to-react-component](https://github.com/benjycui/jsonml-to-react-component) To convert JsonML to React Component.
* [jsonml.js](https://github.com/benjycui/jsonml.js) A collection of JsonML tools.

## Liscence

MIT

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