refactor: use katex instead of mathjax
Signed-off-by: Ryan Wang <i@ryanc.cc>
This commit is contained in:
parent
917a78175b
commit
1a791b0734
|
@ -219,7 +219,6 @@
|
|||
"photosGutter": ${(settings.photos_gutter)!10},
|
||||
"tocDepth": ${(settings.toc_depth)!0},
|
||||
"i18n": "${settings.i18n!'auto'}",
|
||||
"mathjax": "${(settings.mathjax!false)?string('true','')}",
|
||||
"coverNum": "${(settings.rimage_cover_back_num)!'0'}",
|
||||
"rimageUrl": "${(settings.rimage_url)!''}",
|
||||
"coverOpen": "${(settings.rimage_cover_back_open!false)?string('true','')}",
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
<#if settings.photos_style == "justify">
|
||||
<link rel="stylesheet" href="${res_base_url!}/source/lib/justifiedGallery/justifiedGallery.min.css" media="noexist" onload="this.media='all'">
|
||||
</#if>
|
||||
<#if settings.katex!false && (is_post?? || is_sheet??)>
|
||||
<link rel="stylesheet" href="https://unpkg.com/katex@0.12.0/dist/katex.min.css" />
|
||||
</#if>
|
||||
<#include "inc/decorate.ftl">
|
||||
<script type="text/javascript">
|
||||
if (!!window.ActiveXObject || "ActiveXObject" in window) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,24 +0,0 @@
|
|||
function initMathjaxConfig() {
|
||||
MathJax.Hub.Config({
|
||||
showProcessingMessages: false, //关闭js加载过程信息
|
||||
messageStyle: "none", //不显示信息
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
tex2jax: {
|
||||
inlineMath: [["$", "$"], ["\\(", "\\)"]], //行内公式选择符
|
||||
displayMath: [["$$", "$$"], ["\\[", "\\]"]], //段内公式选择符
|
||||
skipTags: ["script", "noscript", "style", "textarea", "pre", "code", "a"], //避开某些标签
|
||||
ignoreClass: "no-math"
|
||||
},
|
||||
"HTML-CSS": {
|
||||
availableFonts: ["STIX", "TeX"], //可选字体
|
||||
showMathMenu: false //关闭右击菜单显示
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!window.MathJax) {
|
||||
// 加载 MathJax
|
||||
Util.loadJS("https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML", initMathjaxConfig)
|
||||
} else {
|
||||
initMathjaxConfig();
|
||||
}
|
|
@ -30,7 +30,6 @@ var LIlGGAttachContext = {
|
|||
Poi.toc && LIlGGAttachContext.TOC(); // 文章目录
|
||||
LIlGGAttachContext.MINI_CODE(); // 迷你代码块
|
||||
PageAttr.isPost === "true" && LIlGGAttachContext.POST_CONTEXT(); // 文章内容处理
|
||||
Poi.mathjax && !!PageAttr.metas.math && PageAttr.metas.math == "true" && LIlGGAttachContext.MATHJAX(); // 数学公式
|
||||
LIlGGAttachContext.CHS(); // 代码样式
|
||||
LIlGGAttachContext.PHO(); // 图库功能
|
||||
LIlGGAttachContext.CMN(); // 评论组件
|
||||
|
@ -863,18 +862,6 @@ var LIlGGAttachContext = {
|
|||
}
|
||||
}
|
||||
},
|
||||
// 渲染数学公式
|
||||
MATHJAX: function() {
|
||||
if (window.MathJax) {
|
||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, document.getElementsByClassName('entry-content')[0]]);
|
||||
} else {
|
||||
Util.loadJS("https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML", function() {
|
||||
Util.loadJS(Poi.resBaseUrl + "/plugins/mathjax/js/index.js", function() {
|
||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, document.getElementsByClassName('entry-content')[0]]);
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// 背景视频点击切换
|
||||
BGEVEN: function() {
|
||||
function nextBG() {
|
||||
|
@ -1535,7 +1522,6 @@ $(function () {
|
|||
Poi.toc && LIlGGAttachContext.TOC(); // 文章目录
|
||||
LIlGGAttachContext.MINI_CODE(); // 迷你代码块
|
||||
PageAttr.isPost === "true" && LIlGGAttachContext.POST_CONTEXT(); // 文章内容处理
|
||||
Poi.mathjax && !!PageAttr.metas.math && PageAttr.metas.math === "true" && LIlGGAttachContext.MATHJAX(); // 数学公式
|
||||
LIlGGAttachContext.CHS(); // 代码类Mac样式、高亮
|
||||
LIlGGAttachContext.MGT(); // 移动端回到顶部
|
||||
(Poi.photosStyle == "packery") && supplement();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2065,13 +2065,12 @@ plugin:
|
|||
label: 开启
|
||||
- value: false
|
||||
label: 关闭
|
||||
mathjax:
|
||||
name: mathjax
|
||||
label: 开启 mathjax 数学公式插件
|
||||
katex:
|
||||
name: katex
|
||||
label: 开启 Katex 公式渲染
|
||||
type: radio
|
||||
data-type: bool
|
||||
default: false
|
||||
description: 数学公式还需要在文章元数据中填写 【K:math, V:true】 才能开启
|
||||
options:
|
||||
- value: true
|
||||
label: 开启
|
||||
|
|
|
@ -6089,7 +6089,8 @@ button.botui-actions-buttons-button {
|
|||
padding-bottom: 0;
|
||||
padding-top: 1px;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
text-size-adjust: 100%;
|
||||
-moz-text-size-adjust: 100%;
|
||||
text-size-adjust: 100%;
|
||||
width: auto
|
||||
}
|
||||
|
||||
|
@ -7303,6 +7304,7 @@ li>ol {
|
|||
}
|
||||
|
||||
.toc {
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
top: 100px
|
||||
}
|
||||
|
@ -9425,5 +9427,4 @@ h1.main-title {
|
|||
.blur-up.lazyloaded {
|
||||
filter: blur(0);
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=style.css.map */
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue