From 5796c0157c1e9c18d17227a4e470ae33c13109f5 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 7 Jun 2026 08:40:48 +0000 Subject: [PATCH] Install official Typst binary and use it for .typ compilation 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 --- server-ce/Dockerfile-base | 6 ++++++ services/clsi/app/js/TypstRunner.js | 16 ++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index 861a9c581e..574b7ed1cf 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -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///. diff --git a/services/clsi/app/js/TypstRunner.js b/services/clsi/app/js/TypstRunner.js index 6a98fad13d..2e3d3f1367 100644 --- a/services/clsi/app/js/TypstRunner.js +++ b/services/clsi/app/js/TypstRunner.js @@ -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] }