https://github.com/posthtml/posthtml-include-md
Include markdown plugin for PostHTML
https://github.com/posthtml/posthtml-include-md
includes markdown posthtml
Last synced: 8 months ago
JSON representation
Include markdown plugin for PostHTML
- Host: GitHub
- URL: https://github.com/posthtml/posthtml-include-md
- Owner: posthtml
- License: mit
- Created: 2019-02-11T13:14:04.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:33:36.000Z (about 3 years ago)
- Last Synced: 2025-06-08T14:04:59.136Z (8 months ago)
- Topics: includes, markdown, posthtml
- Language: JavaScript
- Size: 1.04 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# posthtml-include-md
[](https://npmjs.org/package/posthtml-include-md)
[](https://npmjs.org/package/posthtml-include-md)
[](https://github.com/RichardLitt/standard-readme)
[](https://npmjs.org/package/posthtml-include-md)
[](http://makeapullrequest.com)
> Include markdown plugin for PostHTML. Based on [posthtml-include](https://github.com/posthtml/posthtml-include)
## Table of Contents
- [posthtml-include-md](#posthtml-include-md)
- [Table of Contents](#table-of-contents)
- [Install](#install)
- [Usage](#usage)
- [Configuration](#configuration)
- [Contribute](#contribute)
- [License](#license)
## Install
This project uses [node](https://nodejs.org) and [npm](https://www.npmjs.com).
```sh
$ npm install posthtml-include-md
$ # OR
$ yarn add posthtml-include-md
```
## Usage
```js
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
index.html
```
## Configuration
- `root`: Root folder path for include. Default `./`
- `encoding`: Default `utf-8`
This plugin uses [marked.js](https://marked.js.org) to parse markdown files. All of [marked.js](https://marked.js.org)'s [configuration options](https://marked.js.org/#/USING_ADVANCED.md#options) can be passed.
## Contribute
1. Fork it and create your feature branch: `git checkout -b my-new-feature`
2. Commit your changes: `git commit -am "Add some feature"`
3. Push to the branch: `git push origin my-new-feature`
4. Submit a pull request
## License
MIT