How to?

7月3日让网站支持 Typst

Jul 3, 2025
notesjulyfun
2 Minutes
229 Words
This article was last updated on May 27, 2026 and some of the information may no longer be applicable due to the passage of time.

过程挺浪费时间的. 首先探索 Wypst 方案,发现支持不太行,很难成功 bun dev。Wypst 不维护了应该也是因为 typst 已经支持导出 svg 了,手动转义 AST 到 latex symbol 有点原始人了.

Obsidian-wypst 更是依赖极其原始的 wypst:0.4.0。感觉 npm 这套依赖管理的 backward compability 和一致性不怎么样.

谷歌找到 “@myriaddreamin/rehype-typst”,尝试替代 rehype-mathjax。这是直接用 typst wasm 导出 svg. 但是这玩意儿怎么依赖 katex 呢,有点怪.

起初渲染 typst 公式颜色不对,且独占一行. 使用 https://hanwen.io/zh/posts/use_typst_for_math_in_blog/ 中的 css + AI 写的 typst-inline 检测,看起来正常多了. 折腾了几个 commit 以后成功渲染 typst, 缺点是只支持 typst 而不支持 latex. 如果任何 $ 后不符合 typst 语法都会导致一篇文章无法部署.

Simple solution: see

ref: https://hanwen.io/zh/posts/use_typst_for_math_in_blog/

Typst 群友 @纸夜 做的 Typst 前端集成决策树.

default

Article title:7月3日让网站支持 Typst
Article author:Julyfun
Release time:Jul 3, 2025
Copyright 2026
Sitemap