Support math and mermaid in jekyll/minima theme
Demo link: https://jeffatoptics.github.io/jeff-minima/readme.html
look at below GIF file in https://jeffatoptics.github.io/jeff-minima/readme.html

Purpose
Enhance jekyll/minima template with the support of katex/mathjax equation and mermaid diagram:
-
Enable katex /mathjax math support with
math: katexormath: mathjaxin page front matter. Disable it by removing the above words. -
Enable the mermaid support with
mermaid: defaultmermaid: darkmermaid: baseormermaid: neutraltheme in page front matter. Disable it by removing the above words. -
make a category page to auto display the notes by their category attributes
Major changes from the jekyll/minima
-
Add the codes in custom-head.html to support katex/mathjax and mermaid in
_includesfolder -
Add a category page
Minor changes
They are related to the theme layout and color:
-
set the minima content-width to 1000px:
$content-widthin./_sass/minima/initialize.scss. The default was 800px -
adjust the dark scheme font
$text-colorin./_sass/minima/initialize.scssto a lighter value aseeeeee. it wasbbbbbb$brand-color-lightis adjusted from 5% to 35% -
add an emoji favicon 🐬 in customer-head.html. you can change it to any emoji or remove the line
<link rel="icon".. -
copy auto theme code
auto.scssfrom sandervoerman/minima -
update the
./_layouts/post.htmlto display the categries in each post page.
Usage
- copy all the files to the local folder.
- customizing the
author nameemaildescriptionskinin_config.yml. skin are typicallyclassic,dark,solarized-darkandsolarized - customizing the
index.md - delete the markdown template files in
_postsfolder, and input your own markdown with name “yyyy-mm-dd-topic.md” - delete the images in
assetsfolder, and put your own, and link them with_postmarkdown files - remove or customize the md files in root, i.e. about.md header1.md readme.md and [index_simple.md]
Syntax in your notes
-
katex is using
$ <latex> $as inline equation,$$ <latex> $$and$$ <latex> $$for math block.
-
mathjax is using
$ <latex> $and$$ <latex> $$for inline, and$$ <latex> $$ -
mermaid is using the syntax with
<div>.<div class="mermaid"> graph LR; A-->B; </div> -
link syntax recommendation jekyll liquid syntax always works, but I would recommend to use markdown relative syntax as much as possible to align to local markdown editor. Examples:
[link to a file in post](/jeff-minima/markdown/2022/03/26/markdown-content-styles.html){: width="250"}
Acknowledgement
-
Auto theme code from sandervoerman/minima
-
mathjax code is from link https://zhuanlan.zhihu.com/p/36302775
-
katex reference: https://www.xuningyang.com/blog/2021-01-11-katex-with-jekyll/
-
Mermaid reference: