feat: Adds math-jax support for latex equations, updates gitignore

This commit is contained in:
2025-02-20 16:28:02 -05:00
parent 51d6c4924f
commit 07f3d63a0b
2356 changed files with 38 additions and 329120 deletions

View File

@@ -103,5 +103,6 @@ private func generateHeader(_ pageTitle: String, _ extraHeader: NodeConvertible)
link(href: "/static/style.css", rel: "stylesheet")
link(href: "/articles/feed.xml", rel: "alternate", title: SiteMetadata.name, type: "application/rss+xml")
extraHeader
script(src: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")
}
}

View File

@@ -50,6 +50,19 @@ func getArticleHeader(_ article: Item<ArticleMetadata>) -> NodeConvertible {
meta(content: "1014", name: "og:image:width")
meta(content: "530", name: "og:image:height")
script(crossorigin: "anonymous", src: "https://kit.fontawesome.com/f209982030.js")
Node.raw("""
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
},
svg: {
fontCache: 'global'
}
};
</script>
""")
script(defer: true, src: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js")
}
func renderArticle(context: ItemRenderingContext<ArticleMetadata>) -> Node {