Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
8f8cac20
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8f8cac20
编写于
7月 20, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Add mathjax & katex support
上级
f96db654
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
74 addition
and
3 deletion
+74
-3
layout/_common/head.pug
layout/_common/head.pug
+1
-0
layout/_common/layout.pug
layout/_common/layout.pug
+0
-2
layout/_scripts/common.pug
layout/_scripts/common.pug
+3
-0
layout/_scripts/post.pug
layout/_scripts/post.pug
+0
-1
layout/_third-party/math/index.pug
layout/_third-party/math/index.pug
+15
-0
layout/_third-party/math/katex.pug
layout/_third-party/math/katex.pug
+7
-0
layout/_third-party/math/mathjax.pug
layout/_third-party/math/mathjax.pug
+41
-0
source/js/scroll.js
source/js/scroll.js
+7
-0
未找到文件。
layout/_common/head.pug
浏览文件 @
8f8cac20
...
...
@@ -51,4 +51,5 @@ link(rel="stylesheet" href=`${url_for(theme.css)}/index.css?v=${stun_env("versio
include ../_third-party/analytics/index.pug
include ../_third-party/search/index.pug
include ../_third-party/comments/index.pug
include ../_third-party/math/index.pug
include ./config.pug
layout/_common/layout.pug
浏览文件 @
8f8cac20
...
...
@@ -16,5 +16,3 @@ html(lang=config.language)
include ../_scripts/cdn.pug
include ../_scripts/common.pug
if is_post()
include ../_scripts/post.pug
layout/_scripts/common.pug
浏览文件 @
8f8cac20
...
...
@@ -8,3 +8,6 @@ if theme.sidebar && theme.sidebar.enable
if theme.algolia_search.enable
script(src=`${ url_for(theme.js)}/algolia-search.js?v=${stun_env("version")}`)
if is_post()
script(src=`${url_for(theme.js)}/post.js?v=${stun_env("version")}`)
layout/_scripts/post.pug
已删除
100644 → 0
浏览文件 @
f96db654
script(src=`${url_for(theme.js)}/post.js?v=${stun_env("version")}`)
layout/_third-party/math/index.pug
0 → 100644
浏览文件 @
8f8cac20
if theme.math.enable
- var isHomeHasMath = false;
if is_home()
- page.posts.each(function (post) {
if post.math && !isHomeHasMath
- isHomeHasMath = true
- })
if !is_tag() && !is_category() && !is_archive()
if isHomeHasMath || (theme.math.per_page || page.math)
if theme.math.engine == 'mathjax'
include ./mathjax.pug
else if theme.math.engine == 'katex'
include ./katex.pug
layout/_third-party/math/katex.pug
0 → 100644
浏览文件 @
8f8cac20
link(href=theme.math.katex.cdn rel="stylesheet" type="text/css")
if theme.math.katex.copy_tex.enable
if theme.math.katex.copy_tex.copy_tex_js
script(src=theme.math.katex.copy_tex.copy_tex_js async)
if theme.math.katex.copy_tex.copy_tex_css
link(href=theme.math.katex.copy_tex.copy_tex_css rel="stylesheet" type="text/css")
layout/_third-party/math/mathjax.pug
0 → 100644
浏览文件 @
8f8cac20
script(type="text/x-mathjax-config").
var mathjaxMhchem = '';
if (!!'!{theme.math.mathjax.mhchem}') {
mathjaxMhchem = '!{theme.math.mathjax.mhchem}'
MathJax.Ajax.config.path['mhchem'] = mathjaxMhchem;
}
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
TeX: {
extensions: [mathjaxMhchem],
equationNumbers: {
autoNumber: 'AMS'
}
}
});
MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() {
MathJax.InputJax.TeX.prefilterHooks.Add(function(data) {
if (data.display) {
var next = data.script.nextSibling;
while (next && next.nodeName.toLowerCase() === '#text') { next = next.nextSibling }
if (next && next.nodeName.toLowerCase() === 'br') { next.parentNode.removeChild(next) }
}
});
});
script(type="text/x-mathjax-config").
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i = 0; i < all.length; i++) {
document.getElementById(all[i].inputID + '-Frame').parentNode.className += ' has-jax';
}
});
script(src=theme.math.mathjax.cdn async)
source/js/scroll.js
浏览文件 @
8f8cac20
...
...
@@ -2,6 +2,7 @@ $(document).ready(function () {
// The previous distance from the page to the top.
var
prevScrollTop
=
0
;
addContainerToTable
();
// Initial run.
headerNavScroll
();
backToTop
();
...
...
@@ -101,4 +102,10 @@ $(document).ready(function () {
$
(
'
#back-top
'
).
css
(
'
display
'
,
'
none
'
);
}
}
// Add a container outside the tables to make it scroll when needed.
function
addContainerToTable
()
{
var
$wrapper
=
$
(
'
<div style="overflow: auto"></div>
'
);
$
(
'
table
'
).
wrap
(
$wrapper
);
}
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录