This repository has been archived by the owner on Feb 2, 2021. It is now read-only.
1.2.1
-
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:
extend
the default options passed to the parser.- Add
plugins
to the parser. 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'
]
}