Comments (14)
@olOwOlo 使用js只是替换掉em标签,但现在遇到如下问题:$$\left\{ { x }_{ 1 },{ x }_{ 2 },{ x }_{ 3 },...{ x }_{ n } \right\}$$
其中\{
被转义为{
,导致公式解析出错,现在我的解决方式为自定义一个shortcode,如下:
{{ if len .Params | eq 1 }}{{ .Get 0 }}{{ end }}
md中公式替换为:
{{< pure "$$\left\{ { x }_{ 1 },{ x }_{ 2 },{ x }_{ 3 },...{ x }_{ n } \right\}$$" >}}
from hugo-theme-even.
此问题问题比较久远,有点记不清了。大致原因是转移导致公式出错,解决问题的目标就是如何防止被转义,我的做法是利用hugo里的 shortcode 功能,将公式通过shortcode输出,可以防止被转义。
from hugo-theme-even.
这个问题困扰了我好久, 刚刚在 gohugo.org/doc/tutorials/mathjax/ 看到可以通过使用 <div>
将数学公式包起来结局,希望能帮助到同样有这个问题的人
from hugo-theme-even.
两个 _
是 markdown 语法,用转义字符 \_
试试
from hugo-theme-even.
vscode或有些网站的mathjax是不用\_
转义的。不同环境下转换起来很崩溃。
看了下官网有多种解决方法:
https://gohugo.io/content-management/formats/#mmark
第一种我使用mmark,但会导致页面toc目录无法显示。
---
title: My Post
date: 2017-04-01
markup: mmark
---
另一种方法修改代码还没试...
from hugo-theme-even.
或者再增加个 KaTeX ,代替 MathJax
http://nosubstance.me/post/a-great-toolset-for-static-blogging/
from hugo-theme-even.
或者再增加个 KaTeX ,代替 MathJax
KaTeX 能识别 <em>{k}{G</em>
这样的 ❓
粗暴点直接替换也是可以的(笑)
document.querySelector('.post .post-content').innerHTML.match(/\$\$.*(<em>(.*)<\/em>).*\$\$/)
from hugo-theme-even.
可以试试在 mathjax 之前加入这段代码~
var postContainer = document.querySelector('.post .post-content');
postContainer.innerHTML = postContainer.innerHTML.replace(/\$\$.*(?:<em>.*<\/em>.*)+\$\$/g, function (match) {
return match.replace(/<\/?em>/g, '_');
});
from hugo-theme-even.
@olOwOlo 这个替换的方式可以用
from hugo-theme-even.
我遇到了同样的问题,可是您的解释我有些看不懂,可以给些提示吗? @MACDfree
from hugo-theme-even.
@MACDfree 学到了,谢谢~
from hugo-theme-even.
升级 hugo 后,hugo 默认的 markdown 解析器换成了 goldmark,但这会导致用 <div>
包围的公式显示不了,要换回 blackfriday 才行:
[markup]
defaultMarkdownHandler = "blackfriday"
from hugo-theme-even.
katex
\_
所有的反斜杠都被转义了,导致katex解析错误,有办法解决么?
from hugo-theme-even.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
from hugo-theme-even.
Related Issues (20)
- Is home page no longer showing recent posts? HOT 1
- uglyURLS=true和permenent link不起作用 HOT 1
- some requst js missing HOT 3
- 突然间无法通过 hugo 渲染 md 文件 HOT 2
- 导航栏的tags和categories的字母自动为小写? HOT 1
- 文章比较长时目录与文章不能对应 HOT 1
- GA4 support
- How to change the theme color to grayish or black? HOT 2
- Request: YouTube social icon HOT 2
- The google_news internal template will be removed in a future release. HOT 1
- 使用 uglyurls 时,文章标题下方的 categories 链接不正确 HOT 1
- 简体中文翻译 " readmore " 为 " 查看全文 " HOT 1
- Sticky navbar HOT 1
- uglyURLs 会导致 tags无法使用 HOT 1
- 作者好像失联了,有谁发起一份新的clone来维护吗? HOT 1
- hugo 更新v0.112.3 之后出现:can't evaluate field RSSLink in type page.Site HOT 2
- TOC 的宽度可以通过config.toml调整吗
- 分类、标签英文首字母大写后,再通过分类或标签进入文章时,会报404的错误。 HOT 2
- 目录或文章太长会导致,目录折叠但是展开的时候,看不完全,只能看一部分 HOT 1
- ERROR render of "taxonomy" failed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugo-theme-even.