Skip to content

Commit

Permalink
Merge 951cd69 into ceb5cfe
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Doughty committed Nov 9, 2015
2 parents ceb5cfe + 951cd69 commit 379ee0b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -116,6 +116,12 @@ Default value: `[]`

An array of Remarkable plugin functions, that extend the markdown parser functionality.

##### options.remarkable.syntax
Type: `Array` of optional remarkable syntax `Strings`s
Default value: `[]`

An array of [optional Remarkable syntax extensions](https://github.com/jonschlinkert/remarkable#syntax-extensions), disabled by default, that extend the markdown parser functionality.

API
---

Expand Down Expand Up @@ -226,7 +232,8 @@ var options = {
remarkable: {
html: true,
breaks: true,
plugins: [ require('remarkable-classy') ]
plugins: [ require('remarkable-classy') ],
syntax: [ 'footnote', 'sup', 'sub' ]
}
}

Expand Down
15 changes: 15 additions & 0 deletions index.js
Expand Up @@ -27,6 +27,7 @@ function markdownpdf (opts) {
opts.preProcessHtml = opts.preProcessHtml || function () { return through() }
opts.remarkable = opts.remarkable || {}
opts.remarkable.plugins = opts.remarkable.plugins || []
opts.remarkable.syntax = opts.remarkable.syntax || []

var md = ""

Expand Down Expand Up @@ -60,6 +61,20 @@ function markdownpdf (opts) {
mdParser.use(plugin)
}
})

opts.remarkable.syntax.forEach(function(rule)
{
try {
mdParser.core.ruler.enable([rule])
} catch (er) {}
try {
mdParser.block.ruler.enable([rule])
} catch (er) {}
try {
mdParser.inline.ruler.enable([rule])
} catch (er) {}
})


self.push(mdParser.render(md))
self.push(null)
Expand Down

0 comments on commit 379ee0b

Please sign in to comment.