tufu9441 / maupassant-hexo

A simple Hexo theme forked from icylogic.
https://www.haomwei.com
MIT License
2.61k stars 670 forks source link

可以支持 mermaid 嘛? #539

Open domeniczz opened 1 year ago

domeniczz commented 1 year ago

我根据网上教程,安装了 hexo-filter-mermaid-diagrams

该项目的 readme 中写,需要在主题的 after_footer.pug 中添加

if theme.mermaid.enable == true
  script(type='text/javascript', id='maid-script' mermaidoptioins=theme.mermaid.options src='https://unpkg.com/mermaid@'+ theme.mermaid.version + '/dist/mermaid.min.js' + '?v=' + theme.version)
  script.
    if (window.mermaid) {
      var options = JSON.parse(document.getElementById('maid-script').getAttribute('mermaidoptioins'));
      mermaid.initialize(options);
    }

但我们的主题中没有 after_footer.pug,所以,我自己新建了该文件,并把以上代码粘贴进去

但是没有效果,mermaid 还是无法被渲染

请问有什么解决方案嘛,万分感谢!!!!!!!

cirry commented 1 year ago

主题的文件位置在themes/maupassant/layout/_partial/after_footer.pug 根据文档,先装包,后配置,亲测可以使用。 image