convert markdown to json object

后端 未结 3 2002
抹茶落季
抹茶落季 2020-12-29 14:08

I have a markdown file imported in a node module like this through a webpack loader

import mardownFile from \'./markdownfile.md\'

this file is a

3条回答
  •  一整个雨季
    2020-12-29 14:56

    Try the markdown-to-json library.

    npm install -g markdown-to-json
    

    Given a file called lottery.md I go to the directory in my terminal and type:

    m2j lottery.md
    

    This outputs the json on the screen.

    If you're using a bash based terminal you can pipe that output into a file like this.

    m2j lottery.md >> lottery.json
    

    Which will create a json file called lottery.json in the same folder as your markdown.

    For additional help you can use:

    m2j -h
    

提交回复
热议问题