Call Typst binary directly for compile and SyncTeX support
Build and Deploy Verso / deploy (push) Successful in 13m8s
Build and Deploy Verso / deploy (push) Successful in 13m8s
Instead of going through 'quarto typst compile' (which intercepts --synctex before it reaches Typst), call the Typst binary bundled in the Quarto .deb directly at /opt/quarto/bin/tools/x86_64/typst. This allows passing --synctex output.synctex.gz to generate the SyncTeX file for bidirectional editor↔PDF sync. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,11 +7,15 @@ import fs from 'node:fs'
|
||||
// Maps currently-running Typst jobs: compileName → PID (or docker container id)
|
||||
const ProcessTable = {}
|
||||
|
||||
// Compiles a standalone Typst document (.typ) straight to output.pdf. We reuse
|
||||
// the Typst that ships inside Quarto via `quarto typst compile`, so there is no
|
||||
// extra binary to install. 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).
|
||||
// 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).
|
||||
function runTypst(compileName, options, callback) {
|
||||
const { directory, mainFile, image, environment, compileGroup } = options
|
||||
const timeout = options.timeout || 60000
|
||||
@@ -61,7 +65,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 = `quarto typst compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1`
|
||||
const cmd = `${TYPST_BIN} compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1`
|
||||
return ['/bin/sh', '-c', cmd]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user