fixed incompatibilities with Linux and Windows (closes #124 #128)
Merged new parser API to allow more powerful plugin usage. (#119, thanks to @arrkiin for the work and patience)
There are three ways to configure the parser:
1) extend
the default options passed to the parser.
2) Add plugins
to the parser.
3) customize
the parser after it was created.
Example usage:
// nuxtent.config.js
const Prism = require('prismjs')
const externalLinks = require('markdown-it-link-attributes')
const emoji = require('markdown-it-emoji')
const twemoji = require('twemoji')
module.exports = {
parsers: {
md: {
extend(config) {
config.highlight = (code, lang) => {
return `<pre class="language-${lang}"><code class="language-${lang}">${Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)}</code></pre>`
}
},
plugins: [
emoji,
[ externalLinks, { target: '_blank', rel: 'noopener' } ]
],
customize(parser) {
parser.linkify.tlds('onion')
parser.linkify.add(... custom code to recognize and handle twitter handles ...)
parser.renderer.rules['emoji'] = (token, idx) => {
return twemoji.parse(token[idx].content);
}
}
}
},
...
css: [
'prismjs/themes/prism-coy.css'
]
}