markdown 您所在的位置:网站首页 markdown-it-container markdown

markdown

2024-07-01 17:39| 来源: 网络整理| 查看: 265

vite 插件中配置

 

Markdown({ markdownItOptions: { highlight: function (str, lang) { if (lang && hljs.getLanguage(lang)) { try { return hljs.highlight(lang, str).value; } catch (__) {} } return ''; // 使用额外的默认转义 } }, markdownItSetup(md) { md.use(require('markdown-it-container'), 'demo', { validate: function (params) { return params.trim().match(/^demo\s*(.*)$/); }, render: function (tokens, idx) { const m = tokens[idx].info.trim().match(/^demo\s*(.*)$/); console.log(m); if (tokens[idx].nesting === 1) { // opening tag return '' + md.utils.escapeHtml(m[1]) + '\n'; } else { // closing tag return '\n'; } } }); } })

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有