Package Exports
- markdown-parse
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (markdown-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
markdown-parse
convert a markdown file into HTML and extract YAML front matter
installation
$ npm install markdown-parseusage
From a markdown file like this:
---
apples: hello
list:
- 5
- 10
map:
apple: 1
orange: 2
---
hello world
* list 1
* list 2You can process it:
var parser = require('markdown-parse');
var content = fs.readFileSync(__dirname + '/testpage.md', 'utf8')
parser(content, function(err, result){
console.log('the original body:')
console.log(result.body)
console.log('the html:')
console.log(result.html)
console.log('the front matter:')
console.dir(result.attributes)
})api
parser(text, callback(err, result){})
Process a markdown string that has optional front-matter
The result has the following attributes:
- body - the original markdown body
- html - the converted HTML body
- attributes - the front-matter properties
license
MIT