diff --git a/lib/util/parsers.js b/lib/util/parsers.js index d49a834..d310d2f 100644 --- a/lib/util/parsers.js +++ b/lib/util/parsers.js @@ -2,14 +2,20 @@ import yamlit from 'js-yaml' import markdownit from 'markdown-it' import markdownAnchors from 'markdown-it-anchor' -export const mdParser = ({ highlight, use }, { anchorsLevel }) => { - const parser = markdownit({ +export const mdParser = ( md , { anchorsLevel }) => { + + var config = { preset: 'default', html: true, typographer: true, linkify: true, - highlight - }) + } + + if (md.extend !== undefined ){ + md.extend(config) + } + + const parser = markdownit(config) const plugins = [ [ @@ -18,7 +24,7 @@ export const mdParser = ({ highlight, use }, { anchorsLevel }) => { level: [anchorsLevel] } ] - ].concat(use) + ].concat(md.plugins) plugins.forEach(plugin => { Array.isArray(plugin) @@ -26,6 +32,10 @@ export const mdParser = ({ highlight, use }, { anchorsLevel }) => { : parser.use(plugin) }) + if (md.customize !== undefined ){ + md.customize(parser) + } + return parser }