From fb78d7b019ed4a1cbffacf8405a20fe970a6490d Mon Sep 17 00:00:00 2001 From: reptee <109033451+reptee@users.noreply.github.com> Date: Mon, 1 Jan 2024 20:46:30 +0000 Subject: [PATCH] KaTeX support (#489) --- docs/tips/js/math.md | 18 +++++++++++++++++- emanote/CHANGELOG.md | 1 + emanote/default/index.yaml | 14 ++++++++++++++ emanote/emanote.cabal | 2 +- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/tips/js/math.md b/docs/tips/js/math.md index b0bf9a02f..9551769c6 100644 --- a/docs/tips/js/math.md +++ b/docs/tips/js/math.md @@ -8,6 +8,8 @@ page: # Math +## MathJax + [MathJax](https://www.mathjax.org) can be used to render Math formulas. For example, $a^2 + b ^ 2 = c$. To enable it, add the following to `page.headHtml` of [[yaml-config|YAML configuration]] or Markdown frontmatter. @@ -18,7 +20,21 @@ page: ``` -## Demo +### Demo When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ + + +## KaTeX + +[KaTeX](https://katex.org/) can be used as an alternative to MathJax. Just like MathJax, it renders math specified between dollar signs. + +To enable it: + +```yaml +page: + headHtml: | + +``` + diff --git a/emanote/CHANGELOG.md b/emanote/CHANGELOG.md index dcdc98cff..325089dbb 100644 --- a/emanote/CHANGELOG.md +++ b/emanote/CHANGELOG.md @@ -11,6 +11,7 @@ - The semantics of `folder-folgezettel` is now applied in inverse (see docs) - Allow specifying custom page title in sidebar ([\#488](https://github.com/srid/emanote/pull/488)) - Allow specifying `lang` attribute for HTML page in YAML config ([\#485](https://github.com/srid/emanote/pull/485)) + - KaTeX support ([\#489](https://github.com/srid/emanote/pull/489)) - Bug fixes: - Emanote no longer crashes when run on an empty directory ([\#487](https://github.com/srid/emanote/issues/487)) diff --git a/emanote/default/index.yaml b/emanote/default/index.yaml index 6688b70fa..88b87ca0a 100644 --- a/emanote/default/index.yaml +++ b/emanote/default/index.yaml @@ -138,6 +138,20 @@ js: }; + katex: | + + + emanote: # Whether to automatically treat folder notes as a folgezettel parent of its contents diff --git a/emanote/emanote.cabal b/emanote/emanote.cabal index bbf2498f4..8a1c65570 100644 --- a/emanote/emanote.cabal +++ b/emanote/emanote.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: emanote -version: 1.3.3.0 +version: 1.3.4.0 license: AGPL-3.0-only copyright: 2022 Sridhar Ratnakumar maintainer: srid@srid.ca