GithubHelp home page GithubHelp logo

contentful / marked-ast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cribbles/marked-ast

0.0 16.0 0.0 105 KB

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

Shell 0.05% JavaScript 21.04% HTML 78.91%

marked-ast's Introduction

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

marked-ast's People

Contributors

pdubroy avatar cribbles avatar gabro avatar

Watchers

Sascha Konietzke avatar Raza Ali avatar Tony Wooster avatar Daniel A. R. Werner avatar Enrique Amodeo avatar Kevin Barnett avatar James Cloos avatar Johannes Würbach avatar Khaled Garbaya avatar Trung Nguyen avatar Sergii Bezliudnyi avatar Johannes Bugiel avatar Jigyasa Makkar avatar Vlad avatar Makinwa Olubukola avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.