mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-28 19:43:31 +08:00
fix: markdown and katex rendering problem
This commit is contained in:
parent
130e2f6607
commit
00357fcd51
12
layouts/partials/article/components/mdtexbug.html
Normal file
12
layouts/partials/article/components/mdtexbug.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!-- ref: https://discourse.gohugo.io/t/braces-in-latex-get-escaped/39742/5 https://discourse.gohugo.io/t/use-goldmark-mathjax-extension/25721/8 https://discourse.gohugo.io/t/mathjax-rendering-problems-due-to-backslashes-interpretation-by-markdown-processor/30482 -->
|
||||||
|
{{ $content := .RawContent }}
|
||||||
|
<!-- this fixes issues with \\ not working correctly -->
|
||||||
|
{{ $content = $content | replaceRE "\\\\\\\\" "\\\\\\\\" }}
|
||||||
|
<!-- this fixes earlier issues with braces -->
|
||||||
|
{{ $content = $content | replaceRE "\\\\{" "\\\\{" }}
|
||||||
|
{{ $content = $content | replaceRE "\\\\}" "\\\\}" }}
|
||||||
|
<!-- this fixes issues with _ preceding a { or a \ -->
|
||||||
|
{{ $content = $content | replaceRE "\\_\\{" "\\_{" }}
|
||||||
|
{{ $content = $content | replaceRE "\\_\\\\" "\\_\\" }}
|
||||||
|
|
||||||
|
{{ $content | .Page.RenderString | safeHTML }}
|
Loading…
Reference in New Issue
Block a user