zl程序教程

您现在的位置是:首页 >  其它

当前栏目

JOE主题MathJax公式支持

支持 主题 公式 Joe
2023-06-13 09:18:29 时间

1.在 functions.php 文件中的全站评论开关前增加以下内容

$JMathJax = new Typecho_Widget_Helper_Form_Element_Select(
    'JMathJax',
    array(
        'on' => '开启(默认)',
        'off' => '关闭'
    ),
    'on',
    '开启或关闭全站 MathJax 支持',
    '介绍:开启后,全站支持 MathJax 公式渲染 

     说明:MathJax 是一个 JavaScript 库,用于在网页上显示数学公式 

     其他:MathJax 官网 www.mathjax.org'
);
$JMathJax->setAttribute('class', 'joe_content joe_global');
$form->addInput($JMathJax->multiMode());

2.在 post.php 文件的head标签中添加以下内容

options->JMathJax !== 'off') : ?>
    
        window.MathJax = {
            tex: {
                inlineMath: [ ["$", "$"]],
                displayMath: [ ["$$","$$"]],
                processEscapes: true,
                processEnvironments: true
            },
            options: {
                skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
                ignoreHtmlClass: 'tex2jax_ignore',
                processHtmlClass: 'tex2jax_process'
            }
        };