0

I want to parse markdown to HTML tree in Node.js like:

---
title: 'some text'
create: '2019-10-23'
---

# some text

some text
{
  "meta": {
    "title": "some text",
    "create": "2019-10-23"
  },
  "children": [
    {
      "type": "h1",
      "content": "some text"
    },
    {
      "type": "p",
      "content": "some text"
    }
  ]
}

There were some pkg i found like markdown-it/showdown only can make html string.

Mebtte
  • 129
  • 1
  • 8
  • `markdown-it`'s `parse` will not generate a html but an array of used tokens. Have you tried that? Maybe you can map your desired structure from there. See https://stackoverflow.com/a/40442372/3761628 – eol Nov 05 '20 at 09:49
  • Does this answer your question? [How to tokenize markdown using Node.js?](https://stackoverflow.com/questions/22041795/how-to-tokenize-markdown-using-node-js) – 404 - Brain Not Found Nov 05 '20 at 10:55

0 Answers0