Skip to content

Instantly share code, notes, and snippets.

@kolibril13
Created January 28, 2025 10:53
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "typst",
# ]
# ///
from pathlib import Path
import typst
typst_file = Path.cwd() / "hello.typ"
png_file = Path.cwd() / "hello.png"
file_content = """
#set page(width: auto, height: auto, margin: 1cm, fill: none)
#set text(size: 80pt)
$ sum_(k=1)^n k = (n(n+1)) / 2 $
"""
typst_file.write_text(file_content)
typst.compile(typst_file, format="png", output=str(png_file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment