1.1.1 • Published 7 years ago

reshape-markdown v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Reshape Markdown Parser

Build Status npm version Coverage Status

A parser for the reshape include plugin that allows you to include markdown files into your HTML, uses the markdown-it parser by default.



Install

npm i --save reshape-markdown

Usage

Given an index.html such as:

<p>Partial:</p>
<include src='docs/readme/_partial.md'></include><p>after the partial</p>

And a _partial.md file like:

**hello from the partial!**

You can process them with reshape:

const {readFileSync} = require('fs')
const reshape = require('reshape')
const include = require('reshape-include')
const markdown = require('reshape-markdown')
const html = readFileSync('docs/readme/index.html')

reshape({
  plugins: [
    include({
      parserRules: [
        {
          test: /\.md$/,
          parser: markdown()
        }
      ]
    })
  ]
})
.process(html)
.then((result) => console.log(result.output()))

Generates the output:

<p>Partial:</p>
<p><strong>hello from the partial!</strong></p>
<p>after the partial</p>

Options

  • parser: Markdown parser, must expose a render() function.
  • markdown: Options to pass when instantiating the markdown-it instance.

License

MIT


Created by mkdoc on February 20, 2017

1.1.1

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago