Skip to content

Commit

Permalink
fix(comment/waline): cannot read property ‘insertBefore’ of null (#1103)
Browse files Browse the repository at this point in the history
* fix: resolve issue with comments not displaying due to KaTeX and Waline render order

* Fix the problem that comment data couldn't be pulled successfully and raise Error "Cannot read property ‘insertBefore’ of null""
  • Loading branch information
fsj2009yx authored Dec 22, 2024
1 parent 839fbd0 commit 0991f61
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions layouts/partials/article/components/math.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}}
<script>
window.addEventListener("DOMContentLoaded", () => {
renderMathInElement(document.body, {
const mainArticleElement = document.querySelector(".main-article");
renderMathInElement(mainArticleElement, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
Expand All @@ -10,4 +11,4 @@
],
ignoredClasses: ["gist"]
});})
</script>
</script>

0 comments on commit 0991f61

Please sign in to comment.