From 824b873c69e285d0c8107cc775371c8ee6b4dbe4 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 31 May 2026 14:08:08 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20QuartoRunner:=20drop=20--output=20flag=20?= =?UTF-8?q?to=20let=20Quarto=20run=20full=20typst=E2=86=92PDF=20pipeline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --to typst combined with --output output.pdf caused Quarto to write a Typst source file (.typ content) named output.pdf instead of invoking the typst compiler, producing a text file that the PDF viewer could not render (hence 'markdown not rendered' — it was literally showing the raw .typ markup). Fix: let Quarto name the PDF after the input file (main.qmd → main.pdf) and rename to output.pdf with mv afterwards. Co-Authored-By: Claude Sonnet 4.6 --- services/clsi/app/js/QuartoRunner.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/services/clsi/app/js/QuartoRunner.js b/services/clsi/app/js/QuartoRunner.js index c664bc5691..75ad7bf404 100644 --- a/services/clsi/app/js/QuartoRunner.js +++ b/services/clsi/app/js/QuartoRunner.js @@ -52,18 +52,19 @@ function _buildQuartoCommand(mainFile) { // Run through a POSIX shell so stderr is merged into stdout (2>&1). // Quarto writes all progress and error messages to stderr; without this // the log panel would be empty on failure. - // LocalCommandRunner replaces $COMPILE_DIR before the shell sees the - // string, so no shell variable expansion occurs for that token. - const quartoArgs = [ - 'quarto', - 'render', - `$COMPILE_DIR/${mainFile}`, - '--to', - 'typst', - '--output', - 'output.pdf', - ].join(' ') - return ['/bin/sh', '-c', `${quartoArgs} 2>&1`] + // LocalCommandRunner replaces $COMPILE_DIR before the shell sees it. + // + // Do NOT pass --output: combining --to typst with --output *.pdf causes + // Quarto to write a Typst source file (.typ) with a .pdf extension instead + // of running the full typst→PDF pipeline. Instead, let Quarto name the PDF + // after the source file (main.qmd → main.pdf) and rename it afterwards. + const inputPath = `$COMPILE_DIR/${mainFile}` + const pdfName = mainFile.replace(/\.[^/.]+$/, '') + '.pdf' + const renderedPdf = `$COMPILE_DIR/${pdfName}` + const cmd = + `quarto render ${inputPath} --to typst 2>&1 && ` + + `mv ${renderedPdf} $COMPILE_DIR/output.pdf` + return ['/bin/sh', '-c', cmd] } function _writeLogOutput(compileName, directory, output, callback) {