slidev icon indicating copy to clipboard operation
slidev copied to clipboard

feat: add Typst support as alternative formula renderer

Open KHemanthRaju opened this issue 7 months ago • 4 comments

This PR adds support for Typst as an alternative to KaTeX for formula rendering in Slidev.

Features

  • Added a new formulaRenderer option in frontmatter to choose between 'katex' (default) and 'typst'
  • Implemented Typst.ts integration for rendering Typst formulas
  • Added line highlighting support for Typst formulas
  • Created documentation for Typst usage

Usage

To use Typst as the formula renderer, add this to your frontmatter:

---
formulaRenderer: typst
---

KHemanthRaju avatar May 24 '25 09:05 KHemanthRaju

Deploy Preview for slidev failed.

Name Link
Latest commit dcd87de3df52517386bd6fed3ebbef90d558bc30
Latest deploy log https://app.netlify.com/projects/slidev/deploys/6831922d4451b20008d374aa

netlify[bot] avatar May 24 '25 09:05 netlify[bot]

There is already a community addons for that https://github.com/slidevjs/slidev/pull/2179, have you tried it? If it works well I don't think we need to have it builtin

antfu avatar May 26 '25 05:05 antfu

There is already a community addons for that https://github.com/slidevjs/slidev/pull/2179, have you tried it? If it works well I don't think we need to have it builtin

Well, to be clear these are different features. Consider this slide, which uses both typst and katex:

---
addons:
  - slidev-addon-typst
---

Given pair of graphs $(H, G)$, determine *if there exists* an injective map $f: V_H \to V_G$ satisfying: 

'''typst
$ (v,v') in E_H <==> (f(v), f(v')) in E_G $ 
'''

vs this slide, which would use typst exclusively via the proposed change:

---
formulaRenderer: typst
---

Given pair of graphs $(H, G)$, determine *if there exists* an injective map $f: V_H to V_G$ satisfying: 

$ (v,v') in E_H <==> (f(v), f(v')) in E_G $ 

Neither the typst plugin nor MDC apparently supports inline syntax, I don't see how to avoid using katex for inline changes, but this is unfavorable.

peekxc avatar Oct 17 '25 16:10 peekxc