一些写 pandoc markdown 的工具
让 AI 帮忙做数学研究,写 notes 还用 LaTeX 并不方便。 AI 的输出就是
markdown,如果自己的 notes 也写 markdown 会方便不少。
需要的东西很简单,写 markdown,有数学公式支持和
citation,最好有定理和证明环境。pandoc markdown
就很合适,像这个网站就是用 hakyll 生成的,用 fenced divs
来写定理环境,用chaoDoc中的 filter
处理,最后在浏览器里预览。
各种编辑器对 pandoc markdown 的支持并不好,于是用 codex 写了不少工具。
Lua version
首先要搞定如何预览 pandocmd,hakyll watch 对预览一个 note
来说太过强大了,于是直接用 pandoc cli+ 一堆 lua filter 来搞定。entr
来看文件改动,保存后自动让 pandoc 转换成 html,扔到在跑 webserver
的文件夹里,最后在浏览器里预览。
预览部分有很多方便的东西,比如能跳转回 zed
的行号,自动刷新浏览器,preview on hover 等等。
/posts/LasserreHierarchy/
数学公式仍然在用MathML
在网页里本来就不该追求多麽完美的公式排版。
至少Firefox里MathML看起来还行,而且也只有MathML能用基于Lato的数学字体LeteSansMath。
这些工具被整合到一个 fish 脚本里,扔到 path 里之后更新这套系统只需要
git pull。
https://github.com/sxlxc/pandocmd-lua
Language server
在 pandocmd 里写 cross-ref 的东西需要经常查看 label 具体叫啥,如果有
texlab/typst 一样的编辑器支持就会方便很多。在写编辑器插件之前就需要有个
language server。
pandocmd 的 tree sitter 有人写过,基于 markdown tree sitter。 codex
直接用 rust 写了个 language server
出来,我完全不知道是怎么写的,但是看起来工作正常。主要在提供 cross ref
的提示以及一个简易 linter。
https://github.com/sxlxc/pandocmd-languageserver
Zed extension
没有发布到 zed 的仓库里,只能通过 install dev extension 的方式安装。
https://github.com/sxlxc/zed-pandoc-markdown