Socket
Socket
Sign inDemoInstall

mark-twain

Package Overview
Dependencies
116
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mark-twain

Parse Markdown into JsonML.


Version published
Weekly downloads
3.6K
decreased by-4.63%
Maintainers
2
Install size
9.72 MB
Created
Weekly downloads
 

Readme

Source

Mark Twain

npm package NPM downloads Dependency Status

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 which is easier to process.

Installation

npm install mark-twain

Usage

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:

{
  // 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

Liscence

MIT

Keywords

FAQs

Last updated on 10 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc