Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] multi renderer support, resolve #476 #481

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -527,11 +527,9 @@ plugins:
# https://github.com/KaTeX/KaTeX
# 使用 hexo-renderer-markdown-it-plus 作为公式渲染器:npm uninstall hexo-renderer-marked --save npm install hexo-renderer-markdown-it-plus --save
katex:
enable: #true # 可以在特定文章的 front-matter 中设置 katex: true 来开启,也可以在这里设置全局开启
enable: #true # hexo-renderer-markdown-it-plus 默认开启 katex,此选项仅用于引入样式
inject: |
<link rel="stylesheet" href="https://gcore.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
<script defer src="https://gcore.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4" crossorigin="anonymous"></script>
<script defer src="https://gcore.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"onload="renderMathInElement(document.body);"></script>

# MathJax
# 需在Markdown文件开头加入mathjax: true
Expand Down
3 changes: 1 addition & 2 deletions scripts/tags/lib/quot.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict'

module.exports = ctx => function(args) {
module.exports = ctx => function (args) {
var el = ''
args = ctx.args.map(args, ['el', 'icon', 'prefix', 'suffix'], ['text'])
if (!args.el) {
Expand Down Expand Up @@ -43,7 +43,6 @@ module.exports = ctx => function(args) {
if (args.el.includes('h')) {
el += '<div' + ' class="tag-plugin quot">'
el += '<' + args.el + ' class="content" id="' + args.text + '"' + type + '>'
el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>'
el += content()
el += '</' + args.el + '>'
el += '</div>'
Expand Down
38 changes: 19 additions & 19 deletions source/css/_components/md.styl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
margin-left: 0.5em
h1,h2,h3,h4,h5,h6
text-align: center
a.headerlink
>a:first-child
display: none
h2
margin: 2em 0 1.5em
Expand Down Expand Up @@ -71,29 +71,29 @@
h1,h2,h3,h4,h5,h6
color: var(--text)
line-height: 1.8
>a:first-child
background: $color-theme
border-radius: 2px
margin-right: 8px
trans1 background
&:hover
background: $color-hover
&:before
content: ''
color: white
font-weight: 700
padding: 0 2px
font-size: $fs-12
h2
font-weight: 500
>a:first-child:before
content: ':'

blockquote, .tag-plugin
h2,h3,h4,h5,h6
margin-top: 0.25em
margin-bottom: 0.25em

a.headerlink
background: $color-theme
border-radius: 2px
margin-right: 8px
trans1 background
a.headerlink:hover
background: $color-hover
a.headerlink:before
content: ''
color: white
font-weight: 700
padding: 0 2px
font-size: $fs-12
h2
font-weight: 500
a.headerlink:before
content: ':'

.md-text.content:first-child .tag-plugin:first-child
margin-top: 0

Expand Down
2 changes: 0 additions & 2 deletions source/css/_components/tag-plugins/quot.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
border-bottom: none
font-weight: 700
padding: 0 24px
a.headerlink
display: none
@media screen and (max-width: $device-mobile)
padding: 0 20px
line-height: 1.2
Expand Down