https://github.com/peduarte/mdhtmljson
Convert Markdown to HTML into a JSON file
https://github.com/peduarte/mdhtmljson
Last synced: 9 months ago
JSON representation
Convert Markdown to HTML into a JSON file
- Host: GitHub
- URL: https://github.com/peduarte/mdhtmljson
- Owner: peduarte
- Created: 2015-08-17T18:11:03.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-10T14:26:18.000Z (almost 11 years ago)
- Last Synced: 2025-10-02T04:57:18.513Z (9 months ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**mdhtmljson** is a simple Node module that takes a URL of a *Markdown* file, converts it to *HTML* and outputs it into a *JSON* file.
### Installation
```
npm install mdhtmljson -g
```
### CLI
```
Usage: mdhtmljson [options]
Options:
-h, --help output usage information
-V, --version output the version number
-o, --output write output to this file – include path (.json file extension not needed)
Example:
$ mdhtmljson https://github.com/peduarte/wallop/blob/master/README.md -o ./data/docs.json
```
#### Example
```
mdhtmljson http://urlto.markdown.md -o /path/to/output.json
```
The command above will output the following in **/path/to/**:
**output.json**
```json
{
"html": "
Contents from the markdown
...
"
}
```
### NodeJS
```js
var mdhtmljson = require('mdhtmljson');
var markdownUrl = 'http://urlto.markdown.md';
var jsonOutput = '/path/to/output.json';
mdhtmljson(markdownUrl, jsonOutput);
```
> **#protip**
> If not **option** is specified, it will output **mdhtml.hson** in your root directory.
## Demo
You can see in action on [wallop site](https://github.com/peduarte/wallop-site) to take the Readme file from [wallop](https://github.com/peduarte/wallop) and use it as documentation on the site too. This way I only have one point of documentation 😁
## Licensing
MIT © 2015 [Pedro Duarte](http://pedroduarte.me)