marked-ast

0.3.0 • Public • Published

marked-ast

A modified version of marked that can produce an abstract syntax tree for Markdown.

Usage

var marked = require('marked-ast');
var ast = marked.parse('_This is **Markdown**_, he said.');
var html = marked.render(ast);

The package is just a wrapper for marked, so the produced HTML should be identical (if it isn't it's a bug). The AST produced in the example would look like this:

[
  {
    "type": "paragraph",
    "text": [
      {
        "type": "em",
        "text": [
          "This is ",
          {
            "type": "strong",
            "text": [ "Markdown" ]
          }
        ]
      },
      ", he said."
    ]
  }
]

Development

Basic setup:

git clone https://github.com/pdubroy/marked-ast.git
cd marked-ast
npm install
git submodule update --init

Running Tests

Use npm test to run the tests. Before checking code in, run npm run prepublish.

Updating Marked

To update to a new version of marked:

cd third_party/marked
git checkout <REF>  # E.g., `git checkout v0.3.3` 
cd ../..
npm run rewrite && npm test

Readme

Keywords

Package Sidebar

Install

npm i marked-ast

Weekly Downloads

326

Version

0.3.0

License

MIT

Last publish

Collaborators

  • dubroy