wagtail-typst

July 5, 2026

sekarang bisa membuat content wagtail menggunakan typst

Sejak versi 0.15.0 typst menyediakan fitur ekspor ke html yang mendukung MathML. Dengan fitur ini kita bisa membuat html dokumen menggunakan sintaksis typst.

Wagtail-typst adalah package yang bisa digunakan di wagtail untuk memanfaatkan hal ini. Tersedia TypstField dan TypstBlock.

TypstField dapat digunakan pada model halaman wagtail Page:

from wagtail.models import Page
from wagtail.admin.panels import FieldPanel
from wagtail_typst.fields import TypstField


class ArticlePage(Page):
    body = TypstField(blank=True)

    content_panels = Page.content_panels + [FieldPanel("body")]

Sedangkan TypstBlock digunakan pada blok StreamField.

from wagtail.fields import StreamField
from wagtail.models import Page
from wagtail_typst.blocks import TypstBlock


class ArticlePage(Page):
    body = StreamField(
        [
            ("typst", TypstBlock()),
            # ... your other blocks
        ],
        use_json_field=True,
    )

detail penggunaan ada pada repository wagtail-typst.

Beberapa contoh fitur typst

Matematika

Euler
$ e^(i pi) + 1 = 0 $
Pecahan, akar
$ x_(1,2) = (-b plus.minus sqrt(b^2 - 4a c)) / (2a), quad
  f'(x) = lim_(h -> 0) (f(x+h) - f(x)) / h $
Vektor, matriks
$ vec(1, 2, 3) quad
  mat(1, 0, 0; 0, cos theta, -sin theta; 0, sin theta, cos theta) quad
  abs(x) = cases(x "if" x >= 0, -x "if" x < 0) $

Kalkulus
$ integral_0^oo e^(-x^2) dif x = sqrt(pi)/2 $ \

$ lim_(n -> oo) (1 + 1/n)^n = e $ \

$ (dif y)/(dif x) = lim_(h -> 0) (f(x+h) - f(x))/h $

Euler

𝑒𝑖𝜋+1=0

Pecahan, akar

𝑥1,2=𝑏±𝑏24𝑎𝑐2𝑎,𝑓(𝑥)=lim0𝑓(𝑥+)𝑓(𝑥)

Vektor, matriks

(123)(1000cos𝜃sin𝜃0sin𝜃cos𝜃)|𝑥|={𝑥if𝑥0𝑥if𝑥<0

Kalkulus

0𝑒𝑥2d𝑥=𝜋2


lim𝑛(1+1𝑛)𝑛=𝑒


d𝑦d𝑥=lim0𝑓(𝑥+)𝑓(𝑥)

tabel

#table(
  columns: 3,
  table.header([Framework], [Bahasa], [Backend]),
  [Candle], [Rust], [CUDA, Metal],
  [Burn], [Rust], [WGPU, tch],
  [tch-rs], [Rust], [libtorch],
)
FrameworkBahasaBackend
CandleRustCUDA, Metal
BurnRustWGPU, tch
tch-rsRustlibtorch

kode

```rust
fn main() {
    let x: Vec<f64> = (0..10).map(|i| (i as f64).sqrt()).collect();
    println!("{x:?}");
}
```
fn main() {
    let x: Vec<f64> = (0..10).map(|i| (i as f64).sqrt()).collect();
    println!("{x:?}");
}

Return to blog

footer