Skip to content

Instantly share code, notes, and snippets.

@uupaa
Last active January 6, 2016 19:08
Show Gist options
  • Save uupaa/e477eb3d4881c7ce489d to your computer and use it in GitHub Desktop.
Save uupaa/e477eb3d4881c7ce489d to your computer and use it in GitHub Desktop.
Markdown parser AST example
{
"type": "markdown",
"node": [{
"type": "heading",
"level": 2,
"node": [{
"type": "paragraph",
"node": [{
"type": "text",
"text": " Documentation\n"
}]
}]
}, {
"type": "disc_list",
"node": [{
"type": "paragraph",
"node": [{
"type": "text",
"text": "[API Spec](https://github.com/uupaa/MarkDown.js/wiki/MarkDown)\n"
}]
}]
}, {
"type": "disc_list",
"node": [{
"type": "paragraph",
"node": [{
"type": "text",
"text": "Level2-1\n"
}]
}, {
"type": "paragraph",
"node": [{
"type": "text",
"text": "Level2-2\n"
}]
}]
}, {
"type": "disc_list",
"node": [{
"type": "paragraph",
"node": [{
"type": "text",
"text": "Level3\n"
}]
}]
}, {
"type": "code_block",
"syntax": "syntax",
"code": [
" a = b + c;\n",
" f = a * 2;\n"
]
}, {
"type": "disc_list",
"node": [{
"type": "paragraph",
"node": [{
"type": "text",
"text": "Level2\n"
}]
}]
}, {
"type": "table",
"block": [
" | table1 | head |\n",
" |--------|------|\n",
" | a | b |\n",
" | c | d |\n"
]
}, {
"type": "hr"
}, {
"type": "block_quote",
"node": [{
"type": "paragraph",
"node": [{
"type": "text",
"text": "Quote Level 1\n Quote Level 2\n, Quote Level 2\nQuote Level 1\n"
}]
}]
}, {
"type": "table",
"block": [
"| table2 | head |\n",
"|--------|------|\n",
"| a | b |\n",
"| c | d |\n"
]
}, {
"type": "block_quote",
"node": [{
"type": "table",
"block": [
[
"| table3 | head |\n",
"|--------|------|\n",
"| a | b |\n",
"| c | d |\n"
]
]
}]
}
]
}

Documentation

  • API Spec
    • Level2-1

    • Level2-2

      • Level3
      a = b + c;
      f = a * 2;
    • Level2

      table1 head
      a b
      c d

Quote Level 1

Quote Level 2 Quote Level 2 Quote Level 1

table2 head
a b
c d
table3 head
a b
c d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment