Skip to content

posthtml/posthtml-include-md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

posthtml-include-md

package version package downloads standard-readme compliant package license make a pull request

Include markdown plugin for PostHTML. Based on posthtml-include

Table of Contents

Install

This project uses node and npm.

$ npm install posthtml-include-md
$ # OR
$ yarn add posthtml-include-md

Usage

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>

Configuration

  • root: Root folder path for include. Default ./
  • encoding: Default utf-8

This plugin uses marked.js to parse markdown files. All of marked.js's configuration 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

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •