Skip to content

A modified version of chjj/marked and pdubroy/marked-ast that can produce an abstract syntax tree for Markdown from a SINGLE, dependency-free file that can be included without node, in svaarala/duktape or as a <script> within browser.

Notifications You must be signed in to change notification settings

elijahz/marked-ast

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

marked-ast

A modified version of marked and marked-ast that can produce an abstract syntax tree for Markdown from a single js file.

IMPORTANT This fork of the project not set up to update from npm sources, I'll work on that later. I just needed a non-nodejs version of this for a project and thought someone else might find it useful.

Tests do not function and need reworked.

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/elijahz/marked-ast.git
cd marked-ast
cp ./markedast.js ~/ProjectDir/markedast.js

About

A modified version of chjj/marked and pdubroy/marked-ast that can produce an abstract syntax tree for Markdown from a SINGLE, dependency-free file that can be included without node, in svaarala/duktape or as a <script> within browser.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 79.4%
  • JavaScript 20.6%