Chgtaxihe's blog Chgtaxihe's blog
首页
练习
算法学习
读书笔记
小玩意

Chgtaxihe

首页
练习
算法学习
读书笔记
小玩意
  • 改用VuePress啦

    • 渲染数学公式
      • You may need an appropriate loader to handle this file type
        • Error: Can't resolve './assets/xxx%E4%BD%BF%E7%94%A8%E6%9C%89%E6%84%9F_1.png
          • 无法使用Element-Ui
          Chgtaxihe
          2021-02-23
          随笔

          改用VuePress啦

          折腾了一下午,将博客从Jekyll迁到了VuePress,终于不用忍受Jekyll别扭的路径啦。

          # 遇到的坑

          # 渲染数学公式

          然而发现vuepress-plugin-mathjax插件不能渲染/begin,搜索了很久都找不到解决方案(猜测是mathjax版本太低了)。

          转用Katex,测试了3个插件

          • markdown-it-math:不能正常渲染
          • markdown-it-texmath:许多符号不支持(如\mod)
          • markdown-it-katex:许多符号不支持(如\mod)

          最终是使用markdown-it-katex (opens new window)解决,插件名@neilsustc/markdown-it-katex

          config.js部分配置如下

            markdown: {
              lineNumbers: true, // 代码行号
              extendMarkdown: md => {
                      md.set({
                          html: true
                      })
                      md.use(require('@neilsustc/markdown-it-katex'), {"throwOnError" : false, "errorColor" : " #cc0000"})
                  }
            },
            head: [
                  ['link', {
                      rel: 'stylesheet',
                      href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css'
                  }],
                  ['link', {
                      rel: "stylesheet",
                      href: "https://cdn.jsdelivr.net/github-markdown-css/2.2.1/github-markdown.css"
                  }]
              ],
          
          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          17
          18
          19

          # You may need an appropriate loader to handle this file type

          需要根据错误提示,具体问题具体分析。

          对于我而言,解决方案如下:

          loader不能识别PNG后缀的文件,改为png即可

          # Error: Can't resolve './assets/xxx%E4%BD%BF%E7%94%A8%E6%9C%89%E6%84%9F_1.png

          https://segmentfault.com/a/1190000022275001

          # 无法使用Element-Ui

          https://blog.csdn.net/qq_32855007/article/details/108726430


          至此,本地build成功

          上次更新: 2021/02/25, 00:14:46
          最近更新
          01
          深入理解Java虚拟机
          03-04
          02
          DNS工作原理
          02-27
          03
          ThinkingInJava读书笔记
          02-23
          更多文章>
          Theme by Vdoing | Copyright © 2019-2021
          • 跟随系统
          • 浅色模式
          • 深色模式
          • 阅读模式