Install official Typst binary and use it for .typ compilation
Build and Deploy Verso / deploy (push) Has been cancelled

Quarto bundles a modified Typst fork that lacks --synctex, making
bidirectional sync impossible. Install the official Typst binary
(v0.13.1) from upstream and use it in TypstRunner instead.

This also means .typ projects now use the unmodified Typst compiler,
which is correct since TypstRunner handles plain .typ files (not .qmd).
QuartoRunner continues to use Quarto's bundled Typst internally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-07 08:40:48 +00:00
parent 3f68c147a4
commit 5796c0157c
2 changed files with 12 additions and 10 deletions
+6
View File
@@ -48,6 +48,12 @@ RUN curl -fsSL "https://github.com/quarto-dev/quarto-cli/releases/download/v${QU
&& mkdir -p /var/www/.cache/quarto /var/www/.local/share \
&& chown -R www-data:www-data /var/www/.cache /var/www/.local
# Install official Typst binary (Quarto bundles a modified fork without --synctex)
# ---------------------------------------------------------------------------------
ARG TYPST_VERSION=0.13.1
RUN curl -fsSL "https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-x86_64-unknown-linux-musl.tar.xz" \
| tar -xJC /usr/local/bin --strip-components=1 "typst-x86_64-unknown-linux-musl/typst"
# Pre-install popular Quarto extensions
# -----------------------------------------------------------------------
# Extensions land in /opt/quarto-extensions/_extensions/<author>/<name>/.
+6 -10
View File
@@ -7,15 +7,11 @@ import fs from 'node:fs'
// Maps currently-running Typst jobs: compileName → PID (or docker container id)
const ProcessTable = {}
// Path to the Typst binary bundled inside the Quarto .deb installation.
const TYPST_BIN = '/opt/quarto/bin/tools/x86_64/typst'
// Compiles a standalone Typst document (.typ) straight to output.pdf. We call
// the Typst binary that ships inside Quarto directly (rather than going through
// `quarto typst compile`) so we can pass --synctex for bidirectional sync.
// This is deliberately the simplest of the three runners: Typst only ever
// produces a PDF, so there is no format detection, no HTML asset directory
// and no extension merging (cf. QuartoRunner).
// Compiles a standalone Typst document (.typ) straight to output.pdf using the
// official Typst binary (installed separately from Quarto, which bundles a
// modified fork that lacks --synctex). This is deliberately the simplest of
// the three runners: Typst only ever produces a PDF, so there is no format
// detection, no HTML asset directory and no extension merging (cf. QuartoRunner).
function runTypst(compileName, options, callback) {
const { directory, mainFile, image, environment, compileGroup } = options
const timeout = options.timeout || 60000
@@ -65,7 +61,7 @@ function _buildTypstCommand(mainFile) {
// --synctex generates output.synctex.gz alongside the PDF, enabling
// bidirectional editor↔PDF sync (same infrastructure as LaTeX SyncTeX).
const inputPath = `$COMPILE_DIR/${mainFile}`
const cmd = `${TYPST_BIN} compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1`
const cmd = `typst compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1`
return ['/bin/sh', '-c', cmd]
}