Skip to content

vitepress支持数学公式

js
export default defineConfig({
 
  head: [
    ['script', { async: '', src: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' }]
    , [
      'script',
      {},
      `
      window.MathJax = {
        extensions: ["tex2jax.js"],
        jax: ["input/TeX", "output/HTML-CSS"],
        tex2jax: {
          inlineMath: [['$', '$'], ['\\\\(', '\\\\)']],
          displayMath: [['$$', '$$'], ['\\\\[', '\\\\]']],
          processEscapes: true
        },
        "HTML-CSS": { availableFonts: ["TeX"] }
      };
      `
    ],
  ],
})