Socket
Socket
Sign inDemoInstall

marked-ast

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    marked-ast

Parses Markdown into an abstract syntax tree. Based on github.com/chjj/marked.


Version published
Maintainers
1
Install size
576 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 01 Feb 2016

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