Include markdown plugin for PostHTML. Based on posthtml-include
This project uses node and npm.
$ npm install posthtml-include-md
$ # OR
$ yarn add posthtml-include-md
const { readFileSync } = require('fs')
const posthtml = require('posthtml')
const includeMD = require('posthtml-include-md')
const html = readFileSync('index.html')
posthtml([ include({ encoding: 'utf8' }) ])
.process(html)
.then((result) => console.log(result.html))
In the HTML:
<html>
<head>
<title>index.html</title>
</head>
<body>
<markdown src="posts/hello.html"></markdown>
</body>
</html>
root
: Root folder path for include. Default./
encoding
: Defaultutf-8
This plugin uses marked.js to parse markdown files. All of marked.js's configuration options can be passed.
- Fork it and 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
MIT