0.12.4 • Published 5 years ago

markdown-tree-parser v0.12.4

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

markdown-tree-parser

Parse markdown string to Abstract Syntax Tree which we defined.

Installation

This package is available on npmjs.org. You can install via npm command:

$ npm install markdown-tree-parser

Usage

Import this package and apply markdown string.

const mtp = require('markdown-tree-parser');
const text = `
# Heading 1

This is **markdown** text!`;

const tree = mtp(text);
console.log(tree.dump());

>>>
[
  {
    "name": "heading",
    "type": "block",
    "level": 1,
    "values": [
      {
        "name": "text",
        "type": "inline",
        "value": "Heading 1"
      }
    ]
  },
  {
    "name": "paragraph",
    "type": "block",
    "values": [
      {
        "name": "text",
        "type": "inline",
        "value": "This is "
      },
      {
        "name": "em",
        "type": "inline",
        "value": "markdown"
      },
      {
        "name": "text",
        "type": "inline",
        "value": " text!"
      }
    ]
  }
]

Support syntax

Basic Markdown syntax

  • strong
  • italic
  • string+italic
  • image
  • link
  • headings
  • horizontal rule
  • blockquote
  • unordeed list
  • ordeed list

Github Flavored Markdown sytax

  • strikethrough GFM extend
  • code
  • task list (list with checkbox)
  • table

Author

Yoshiaki Sugimoto

License

MIT

0.12.4

5 years ago

0.12.2

6 years ago

0.12.1

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.1

6 years ago

0.10.0

6 years ago