post-loader
Install
yarn add post-loader --dev
Usage
const postLoader = moduleexports = module: rules: test: /\.md$/ loader: 'post-loader'
Example
Given my-blog-post.md
:
---title: hello there---post **body**
Yields:
"data": "title": "hello there" "date": "2017-02-28T14:57:59.000Z" "content": "post **body**" "html": null
Which is require-able
in other files:
console//=> hello there
Note: We automatically set date
to the birthtime of the file if no date
is set in front-matter.
Use a markdown parser
const postLoader = moduleexports = module: rules: test: /\.md$/ loader: 'post-loader' options: { return someMarkdownParser }
Given the same markdown content as used above, it yields:
"data": "title": "hello there" "date": "2017-02-28T14:57:59.000Z" "content": "post **body**" "html": "<p>post <strong>options</strong></p>\\\\n\\"
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
post-loader © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @_egoistlily