### Install Calepin with the official installer (macOS/Linux) Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Runs the official Calepin installer script for macOS and Linux. Requires Typst 0.15.0 or newer to be available on PATH. ```bash curl --proto '=https' --tlsv1.2 -LsSf https://github.com/vincentarelbundock/calepin/releases/latest/download/calepin-installer.sh | sh ``` -------------------------------- ### Initialize a Calepin notebook Source: https://vincentarelbundock.github.io/calepin/getting-started/basics.html The standard setup for a Calepin notebook, importing the necessary helper functions and configuring the document. ```typst #import "/.calepin/calepin.typ" as calepin #show: calepin.document #set document(title: [My analysis]) = Introduction This is regular Typst prose. The expression #math.equation(alt: "pi r squared", block: false, $pi r^2$) is regular Typst math. ``` -------------------------------- ### Install Calepin with Cargo Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Installs Calepin for Rust users via Cargo. ```bash cargo install calepin ``` -------------------------------- ### Initialize a simple computational notebook Source: https://vincentarelbundock.github.io/calepin/index.html Setup a Typst document with Calepin, configuring echo and result display, and defining a Python inline helper. ```typst #import "/.calepin/calepin.typ" as calepin #show: calepin.document #calepin.setup( echo: true, results: "verbatim", ) #let py = calepin.inline.with("python") ``` -------------------------------- ### Scaffold a new website with a custom theme using --theme Source: https://vincentarelbundock.github.io/calepin/websites/websites.html Starts a new website from another built-in theme, such as `academic`. ```bash calepin new website --theme academic ``` -------------------------------- ### Website project structure with local theme Source: https://vincentarelbundock.github.io/calepin/themes/case_studies.html Shows the directory layout for the website example, including the theme directory, configuration, and content files. ```text calepin_website/ theme/ # theme directory theme.toml css/ fonts.css calepin.toml # website configuration file index.typ # website content 404.typ assets/ posts/ ``` -------------------------------- ### Install Calepin on Windows via PowerShell Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Installs Calepin on Windows using the official PowerShell installer script. ```powershell powershell -ExecutionPolicy Bypass -c "irm https://github.com/vincentarelbundock/calepin/releases/latest/download/calepin-installer.ps1 | iex" ``` -------------------------------- ### Install Calepin with Homebrew Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Installs Calepin on macOS using Homebrew from the vincentarelbundock/tap tap. ```bash brew install vincentarelbundock/tap/calepin ``` -------------------------------- ### Data example A Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html Example of a simple data structure A. ```text x 1 1 2 2 ``` -------------------------------- ### Basic calepin.toml configuration Source: https://vincentarelbundock.github.io/calepin/websites/configuration.html A comprehensive example of the calepin.toml configuration file, covering site metadata, theme selection, output directories, and asset paths. ```toml # Site name shown by bundled themes and page metadata. # Default: none. title = "My Site" # Short site description for metadata and previews. # Default: none. description = "A static website built from Typst documents." # Public site URL, used for sitemap.xml and canonical URLs. # Default: none. base-url = "https://example.com" # Theme: "calepin", "academic", a local theme directory, or false for raw output. # Default: "calepin". theme = "calepin" # Render .pdf files for every page. # Default: false. pdf = false # Publish each page's Typst source: copy .typ files to the output directory # and embed the source for the theme's view-source mode. # Default: true. typ = false # Minify generated HTML, including inline CSS and JavaScript. # Default: false. minify = true # Default output directory for website builds, relative to calepin.toml. # A positional output path on the command line takes precedence. # Default: build in place, in the website source directory. output-dir = "../_site" # Static search engine. Set to "pagefind" to generate a search index. # Default: none. search = "pagefind" # Generate web feeds (requires base-url). Use `feeds = true` for a default # atom.xml, or a [feeds] table for custom filenames and templates. # Default: false. feeds = true # Generate llms.txt, a Markdown index of the site for LLM consumers. # Default: true. llms = false # Logo image path for the top bar. # Default: none. logo = "assets/logo.svg" # Alternative text for the logo image. Defaults to `title` when omitted. # Default: none. logo-alt = "My Site" # Output directory for browser-facing generated assets. # Also controls where the Calepin runtime is written. # Default: ".calepin". asset-dir = "_calepin" # Browser favicon path. Omit this to use Calepin's generated default. # Default: `asset-dir`/favicon.svg. favicon = "assets/favicon.ico" # Default social-card image for link previews. Needs `base-url` unless the # value is already an absolute URL. Pages override it with `image`. # Default: none. image = "assets/social-card.png" # Tint applied to browser UI on mobile. # Default: none. theme-color = "#1b1b1b" # HTML syntax highlighting themes. Paths are relative to calepin.toml. # Default: built-in Calepin light and dark themes. highlight-light = "themes/syntax/light.tmTheme" highlight-dark = "themes/syntax/dark.tmTheme" ``` -------------------------------- ### Example config.toml configuration Source: https://vincentarelbundock.github.io/calepin/getting-started/config.html This configuration file defines the asset directory and paths to required external executables like Typst, Python, and Rscript. ```toml # config.toml # Directory for generated Calepin runtime and website assets. # Default: ".calepin". Use "_calepin" for Netlify or GitHub Pages. asset-dir = ".calepin" [executables] typst = "typst" # Typst binary (can be name or full path) python = ".venv/bin/python" # Python interpreter rscript = "Rscript" # R executable mmdc = "mmdc" # Mermaid #dot = "/opt/homebrew/bin/dot" # optional, if needed #d2 = "d2" # optional #tectonic = "tectonic" # optional #dvisvgm = "dvisvgm" # optional #pdf2svg = "pdf2svg" # optional ``` -------------------------------- ### Configure sidebar with a single page target Source: https://vincentarelbundock.github.io/calepin/websites/navigation.html Defines a sidebar section titled 'Guide' with one item pointing to 'install.typ'. Use 'target' for a single source page; Calepin resolves it to the corresponding .html link. ```toml [sidebar] [[sidebar.section]] title = "Guide" [[sidebar.section.item]] target = "install.typ" ``` -------------------------------- ### Data example B Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html Example of a data structure B with two columns. ```text x y 1 1 11 2 2 12 ``` -------------------------------- ### Install jupyter_client for Jupyter kernel support Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Installs the jupyter_client package, required to use Jupyter kernels with Calepin. ```bash pip install jupyter_client ``` -------------------------------- ### Install IJulia kernel for Julia Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Installs the IJulia kernel from Julia's own package manager. ```bash # Julia julia -e 'using Pkg; Pkg.add("IJulia")' ``` -------------------------------- ### Example llms.txt content Source: https://vincentarelbundock.github.io/calepin/websites/configuration.html The structure of the generated llms.txt Markdown index file. ```markdown # Example Site > Notes and papers. ## Pages - [Home](https://example.com/): The opening paragraph of the home page. - [Usage](https://example.com/guide/usage.html): How to use it. ``` -------------------------------- ### Hidden chunk output example Source: https://vincentarelbundock.github.io/calepin/notebooks/code_execution.html Example output produced by a hidden chunk when run live. The hidden chunk shows nothing where it is defined, and its output is printed on request. ```text The total is 42. ``` -------------------------------- ### Custom robots.txt template Source: https://vincentarelbundock.github.io/calepin/websites/configuration.html Example of a custom robots.txt template using MiniJinja syntax. ```jinja User-agent: * Disallow: /drafts/ {% if sitemap_url %}Sitemap: {{ sitemap_url }}{% endif %} ``` -------------------------------- ### Calepin New Command Source: https://vincentarelbundock.github.io/calepin/reference/cli.html Used to create a new notebook file, website scaffold, or theme. Includes examples for various creation scenarios. ```text Create a notebook file, website scaffold, or ejected theme Usage: calepin new [OPTIONS] [DIR] Arguments: What to create: a .typ notebook path, `website`, or `theme` [DIR] Destination directory when creating a website scaffold or ejected theme Options: --theme Built-in theme to use when creating a website scaffold or ejected theme [possible values: calepin, academic] -f, --force Overwrite the file if it already exists -h, --help Print help Examples: calepin new paper.typ calepin new website calepin new website --theme academic calepin new theme calepin new theme --theme academic calepin new theme themes/my-theme ``` -------------------------------- ### Start Calepin watcher with config in terminal Source: https://vincentarelbundock.github.io/calepin/editors.html Use when the extension's default `calepin watch --eval-only` does not pick up a `calepin.toml` configuration. This command explicitly passes the config file so interpreter paths under `[executables]` take effect. ```bash calepin watch --config calepin.toml paper.typ --eval-only ``` -------------------------------- ### Enter website Nix development shell and build website Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Enters the heavier website development shell (includes Rust tooling, Typst, uv, R packages, and diagram tools) and runs make website for contributor work on the documentation website. ```bash nix develop github:vincentarelbundock/calepin#website make website ``` -------------------------------- ### Compile and serve website with local theme Source: https://vincentarelbundock.github.io/calepin/themes/case_studies.html Renders the website with the local theme and serves it, opening the browser. ```bash calepin compile calepin_website --set theme=./theme calepin serve calepin_website --open ``` -------------------------------- ### Create and compile a Calepin website Source: https://vincentarelbundock.github.io/calepin/blog/static-website-generation.html Initializes a new Calepin website in the my_site/ directory and compiles it to generate the site output. ```bash calepin new website my_site/ calepin compile my_site/ ``` -------------------------------- ### Create website scaffold with calepin new Source: https://vincentarelbundock.github.io/calepin/themes/case_studies.html Creates a new directory called calepin_website based on the default calepin theme. ```bash calepin new website --theme calepin ``` -------------------------------- ### calepin update command Source: https://vincentarelbundock.github.io/calepin/reference/cli.html Updates the Calepin installation using the official installer updater. ```text Update Calepin using the official installer updater Usage: calepin update Options: -h, --help Print help ``` -------------------------------- ### Data example Z Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html Example of a data structure Z containing mtcars-like data. ```text mpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1 ``` -------------------------------- ### Preview with standard Typst tooling Source: https://vincentarelbundock.github.io/calepin/getting-started/basics.html After compilation, use standard Typst commands to render the notebook. ```bash typst compile paper.typ ``` -------------------------------- ### Data example K Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html Example of a data structure K containing iris-like data. ```text Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa ``` -------------------------------- ### Update Calepin installed via official installer Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Updates Calepin using the calepin-update helper. Only updates Calepin; Typst, Python, R, Jupyter, and Jupyter kernels are managed separately. If calepin-update is missing, reinstall with the official installer. ```bash calepin update ``` -------------------------------- ### Watch and serve website Source: https://vincentarelbundock.github.io/calepin/compile_watch_serve.html Combine watching with a local server to preview changes in real-time. ```bash calepin watch docs docs --serve --open calepin watch my_site public --serve --host 127.0.0.1 --port 8001 ``` -------------------------------- ### Install Jupyter kernels with pip Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Installs several Jupyter kernels using pip: bash_kernel for Bash, octave_kernel for GNU Octave, and gnuplot_kernel for Gnuplot. ```bash pip install bash_kernel # Bash pip install octave_kernel # GNU Octave pip install gnuplot_kernel # Gnuplot ``` -------------------------------- ### Histogram of car weights for `#|` header example Source: https://vincentarelbundock.github.io/calepin/notebooks/cross-references.html The R code for the `#|` header example, producing a histogram of car weights. It is referenced in prose as Figure 2. ```r hist(mtcars$wt, col = "gray80", border = "white") ``` -------------------------------- ### Serve with host and port Source: https://vincentarelbundock.github.io/calepin/compile_watch_serve.html Specify the host and port for the local server. ```bash calepin serve docs --host 127.0.0.1 --port 8001 ``` -------------------------------- ### Compile a website directory in place with calepin compile Source: https://vincentarelbundock.github.io/calepin/websites/websites.html Compiles the website in place: reads from `my_site/` and writes outputs back to `my_site/`. ```bash calepin compile my_site/ ``` -------------------------------- ### Serve the built site locally with calepin serve Source: https://vincentarelbundock.github.io/calepin/websites/websites.html Serves the built site locally, using `127.0.0.1` and the first available port from 8000 by default. ```bash calepin serve my_site/ ``` -------------------------------- ### Upgrade Calepin with Homebrew Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Upgrades an existing Homebrew installation of Calepin. ```bash brew upgrade calepin ``` -------------------------------- ### Compile website directories Source: https://vincentarelbundock.github.io/calepin/compile_watch_serve.html Compile a website by pointing the command at a source directory containing a calepin.toml file. ```bash calepin compile docs docs calepin compile my_site public ``` -------------------------------- ### Extend robots.txt template Source: https://vincentarelbundock.github.io/calepin/websites/configuration.html Example of extending a base template for robots.txt. ```jinja {% extends "base.txt" %} {% block body %} User-agent: * Allow: / {% endblock %} ``` -------------------------------- ### Typst to engine output Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html The rendered output for the Typst to engine example. ```text The course is Data Science. ``` -------------------------------- ### Serve and open in browser Source: https://vincentarelbundock.github.io/calepin/compile_watch_serve.html Automatically open the served website in the default browser. ```bash calepin serve docs --open ``` -------------------------------- ### Set document defaults with #calepin.setup Source: https://vincentarelbundock.github.io/calepin/notebooks/code_execution.html Sets document-wide defaults for every chunk in the document. ```typst #calepin.setup(echo: true, eval: true, results: "verbatim") ``` -------------------------------- ### Colliding page routes Source: https://vincentarelbundock.github.io/calepin/websites/health.html Example of metadata that causes route collisions. ```typst #metadata((slug: "same")) #metadata((url: "same.html")) ``` -------------------------------- ### Compile PDF with classicthesis theme Source: https://vincentarelbundock.github.io/calepin/themes/case_studies.html Renders the PDF from the project root, setting the theme to the local ./theme directory. ```bash calepin compile book.typ --format pdf --set theme=./theme ``` -------------------------------- ### Watch and serve a Calepin website Source: https://vincentarelbundock.github.io/calepin/blog/static-website-generation.html Rebuilds changed pages incrementally, previews the site locally, and opens it in the browser. Use both together while writing. ```bash calepin watch my_site/ my_site/ --serve --open ``` -------------------------------- ### Unsafe page routes Source: https://vincentarelbundock.github.io/calepin/websites/health.html Example of metadata that results in unsafe output routes. ```typst #metadata((slug: "../outside")) #metadata((url: "/absolute/path")) ``` -------------------------------- ### Invalid image calls Source: https://vincentarelbundock.github.io/calepin/websites/health.html Examples of image calls that produce accessibility warnings. ```typst #image("assets/chart.png") #image("assets/chart.png", alt: "") #image("assets/chart.png", alt: none) ``` -------------------------------- ### Serve with custom host and port using --host and --port Source: https://vincentarelbundock.github.io/calepin/websites/websites.html Serves the site on a specific address and port. ```bash calepin serve my_site/ --host 127.0.0.1 --port 8001 ``` -------------------------------- ### Valid image calls Source: https://vincentarelbundock.github.io/calepin/websites/health.html Examples of image calls that pass the accessibility check. ```typst #image("assets/chart.png", alt: "Line chart of quarterly revenue") #image("assets/logo.svg", alt: figure_alt) ``` -------------------------------- ### Compile site with local theme Source: https://vincentarelbundock.github.io/calepin/themes/case_studies.html Command to render the website using the custom local theme. ```bash calepin compile calepin_website --set theme=./theme ``` -------------------------------- ### Set raw theme to match palettes Source: https://vincentarelbundock.github.io/calepin/tips.html Points Typst to the generated syntax theme file at '/.calepin/syntax.tmTheme'. This file is regenerated from 'highlight-light' on every build, so it follows configured colors. Use asset-dir/syntax.tmTheme if the asset directory is moved. ```typst #set raw(theme: "/.calepin/syntax.tmTheme") ``` -------------------------------- ### Example output for R store access Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html The output of the R chunk accessing the store. ```text 21 rows selected ``` -------------------------------- ### Define local theme and extension Source: https://vincentarelbundock.github.io/calepin/websites/configuration.html Point the project configuration to a local theme directory and specify the parent theme to extend in the theme's configuration file. ```toml # calepin.toml theme = "themes/my-site" ``` ```toml # themes/my-site/theme.toml extends = "academic" ``` -------------------------------- ### TikZ vector graphics Source: https://vincentarelbundock.github.io/calepin/notebooks/diagrams.html A TikZ example drawing a blue line and a red circle. ```latex \begin{tikzpicture} \draw[thick, blue] (0,0) -- (2,1) -- (4,0); \fill[red] (2,1) circle (2pt); \end{tikzpicture} ``` -------------------------------- ### Full Touying slides.typ with Calepin Source: https://vincentarelbundock.github.io/calepin/slides/slides.html A complete Touying slide deck that imports Calepin and Touying, sets up the theme, and includes executable Python and R chunks. It demonstrates delayed display using `results: "hidden"` and `#calepin.results(label)` to show output in different columns or slides, and shows that the same label can be reused. ```typst #import "/.calepin/calepin.typ" as calepin #import "@preview/touying:0.7.4": * #import themes.simple: * #show: calepin.document #set document(title: [Calepin Touying slides]) #show: simple-theme.with(aspect-ratio: "16-9") #show raw.where(block: true): set text(size: .8em) #title-slide[ #calepin.setup( echo: true, eval: true, results: "render", ) _Calepin_: Code execution in Touying slides ] == Print from Python ```python print("Hello, Touying!") ``` == Plot from R ```r #| fig-width: 50% #| fig-alt-text: Scatter plot of fuel efficiency against horsepower plot(mpg ~ hp, data = mtcars) ``` == Compute in one column; show in another Use the `results: "hidden"` option to keep the output hidden from the code location, then call it later with `calepin.results(label)` in the other column. #grid(columns: (1fr, 1fr), gutter: .4em, [ === Column 1: Code here #calepin.chunk("python", label: "summary2", results: "hidden")[ ```python values = [2, 3, 5, 8, 13] total = sum(values) print(f"Total = {total}") ``` ] ], [ === Column 2: Output here #calepin.results("summary2") ], ) == Compute in one slide; show in another #calepin.chunk("python", label: "next-slide-claim", results: "hidden")[ ```python baseline = 120 current = 156 change = (current - baseline) / baseline print(f"Change from baseline: {change:.0%}") ``` ] The chunk source is visible here, but `results: "hidden"` keeps its output off this slide. == Result on the next slide #calepin.results("next-slide-claim") The same label can be reused multiple times, anywhere in the deck. #calepin.results("next-slide-claim") ``` -------------------------------- ### Mermaid flowchart diagram Source: https://vincentarelbundock.github.io/calepin/notebooks/diagrams.html A Mermaid diagram example using a left-to-right flowchart layout. ```mermaid %%{init: {"htmlLabels": false}}%% flowchart LR Source["Typst document"] --> Query["Calepin query"] Query --> Execute["Run chunks"] Execute --> Render["Typst render"] ``` -------------------------------- ### Compile a notebook Source: https://vincentarelbundock.github.io/calepin/getting-started/basics.html Run the Calepin compiler to generate the runtime and results for a notebook. ```bash calepin compile paper.typ ``` -------------------------------- ### D2 diagram Source: https://vincentarelbundock.github.io/calepin/notebooks/diagrams.html A D2 diagram example showing a sequence of requests between a client, API, worker, and database. ```d2 direction: right client -> api: request api -> worker: job worker -> database: write ``` -------------------------------- ### Compile notebooks and websites via CLI Source: https://vincentarelbundock.github.io/calepin/index.html Commands to compile a Typst notebook or a website directory using the Calepin CLI. ```bash calepin compile notebook.typ ``` ```bash calepin compile website/ ``` -------------------------------- ### Graphviz DOT graph Source: https://vincentarelbundock.github.io/calepin/notebooks/diagrams.html A Graphviz DOT example defining a simple workflow graph with a revision loop. ```dot digraph { rankdir=LR Draft -> Review -> Publish Review -> Draft [label="revise"] } ``` -------------------------------- ### Opt-in to script extraction Source: https://vincentarelbundock.github.io/calepin/compile_watch_serve.html Disable global script extraction in the setup and opt-in specific chunks individually. ```yaml #calepin.setup(script: false) ``` ```yaml #| script: docker-compose.yml services: ``` ```yaml #| script: docker-compose.yml api: image: example/api ``` -------------------------------- ### Compile notebook with custom theme Source: https://vincentarelbundock.github.io/calepin/themes/css.html Command to compile a notebook using the raw theme. ```bash calepin compile notebook.typ --format html --set theme=raw ``` -------------------------------- ### Eject a built-in theme Source: https://vincentarelbundock.github.io/calepin/themes/themes.html Copy a built-in theme into a local directory to serve as a starting point for customization. ```bash calepin new theme /path/to/my_theme --theme=academic ``` -------------------------------- ### Enter default Nix development shell Source: https://vincentarelbundock.github.io/calepin/getting-started/install.html Enters the minimal default development shell for Calepin. ```bash nix develop github:vincentarelbundock/calepin ``` -------------------------------- ### Rendered nested sidebar structure Source: https://vincentarelbundock.github.io/calepin/websites/navigation.html Shows the rendered output of the nested sidebar example above, with sections and items indented. ```text r-polars lazyframe collect fetch dataframe select filter ``` -------------------------------- ### CLI: pass store values with --set Source: https://vincentarelbundock.github.io/calepin/themes/templating.html Use the calepin compile command with --set flags to pass project-specific values to the template store. ```bash calepin compile notebook.typ --set store.course="Econ 101" --set store.semester="Fall 2026" ``` -------------------------------- ### Serve website directory Source: https://vincentarelbundock.github.io/calepin/compile_watch_serve.html Serve a compiled website directory locally to verify routing and assets. ```bash calepin serve docs calepin serve public ``` -------------------------------- ### Watch website source and recompile on changes Source: https://vincentarelbundock.github.io/calepin/websites/websites.html Watches the source directory and recompiles automatically. The first build renders the whole site; subsequent builds only rebuild changed pages. ```bash calepin watch my_site/ my_site/ ``` -------------------------------- ### Initialize parameters in Typst Source: https://vincentarelbundock.github.io/calepin/notebooks/data_store.html Use #calepin.store.set to define values in Typst that can be accessed by other engines. ```typst #calepin.store.set("species", "versicolor") #calepin.store.set("min_petal_length", 4.5) ``` -------------------------------- ### Select a theme via CLI Source: https://vincentarelbundock.github.io/calepin/themes/themes.html Use the --set theme flag to specify a built-in or local theme directory during compilation. ```bash calepin compile notebook.typ --set theme=calepin calepin compile notebook.typ --set theme=academic calepin compile notebook.typ --set theme=typst calepin compile notebook.typ --set theme=themes/my-theme ```