Skip to content

Commit 3ccdfd4

Browse files
authored
Merge branch 'main' into revealjs/scroll-view
2 parents c39b294 + fc232ee commit 3ccdfd4

File tree

21 files changed

+247
-140
lines changed

21 files changed

+247
-140
lines changed

.github/workflows/test-smokes-parallel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Set up Quarto
4848
uses: quarto-dev/quarto-actions/setup@v2
4949
with:
50-
version: pre-release
50+
version: ${{ github.ref == 'refs/heads/main' && 'pre-release' || 'release' }}
5151

5252
- name: Create Job for tests
5353
id: tests-buckets

news/changelog-1.6.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ All changes included in 1.6:
4242
- ([#9558](https://github.com/quarto-dev/quarto-cli/issues/9558)): To prevent default footer to show on slide, set `footer='false'` attribute on the slide header, e.g. `## Slide with no footer {footer='false'}`
4343
- ([#6012](https://github.com/quarto-dev/quarto-cli/issues/6012)): Add styling for `kbd` element in Revealjs slides.
4444
- ([#10887](https://github.com/quarto-dev/quarto-cli/issues/10887)): Updating default Mathjax used from 2.7.0 to 2.7.9.
45+
- ([#9999](https://github.com/quarto-dev/quarto-cli/issues/9999)): Fix spacing problems of different size elements in columns.
4546

4647
## `typst` Format
4748

@@ -91,6 +92,7 @@ All changes included in 1.6:
9192
- Upgrade `mermaidjs` to 11.2.0.
9293
- Upgrade Pandoc to 3.4.
9394
- Upgrade `deno` to 1.46.3.
95+
- ([#11068](https://github.com/quarto-dev/quarto-cli/issues/11068)): use standard location when writing to standard output to avoid breakage under `self-contained: true`.
9496
- ([#10162](https://github.com/quarto-dev/quarto-cli/issues/10162)): Use Edge on `macOS` as a Chromium browser when available.
9597
- ([#10235](https://github.com/quarto-dev/quarto-cli/issues/10235)): Configure the CI schedule trigger to activate exclusively for the upstream repository.
9698
- ([#10295](https://github.com/quarto-dev/quarto-cli/issues/10235)): Fix regression to return error status to shell when `CommandError` is thrown.

package/launcher/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ fn main() {
8686
String::from("--unstable-ffi"),
8787
String::from("--no-config"),
8888
String::from("--cached-only"),
89+
String::from("--no-lock"),
8990
String::from("--allow-read"),
9091
String::from("--allow-write"),
9192
String::from("--allow-run"),

package/scripts/common/quarto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fi
169169
export DENO_TLS_CA_STORE=system,mozilla
170170
export DENO_NO_UPDATE_CHECK=1
171171
# Be sure to include any already defined QUARTO_DENO_OPTIONS
172-
QUARTO_DENO_OPTIONS="--unstable-ffi --unstable-kv --no-config ${QUARTO_CACHE_OPTIONS} --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi ${QUARTO_DENO_OPTIONS}"
172+
QUARTO_DENO_OPTIONS="--unstable-ffi --unstable-kv --no-config --no-lock ${QUARTO_CACHE_OPTIONS} --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi ${QUARTO_DENO_OPTIONS}"
173173

174174
# --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737
175175
if [ "$QUARTO_DENO_V8_OPTIONS" != "" ]; then

package/scripts/windows/quarto.cmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ IF EXIST "!QUARTO_TS_PATH!" (
5959

6060
SET QUARTO_CACHE_OPTIONS=
6161

62+
REM Turn on type checking for dev version
63+
SET QUARTO_DENO_OPTIONS=--check
64+
6265
) ELSE (
6366

6467
IF NOT DEFINED QUARTO_SHARE_PATH (
@@ -102,7 +105,7 @@ IF NOT DEFINED QUARTO_DENO (
102105

103106
SET "DENO_TLS_CA_STORE=system,mozilla"
104107
SET "DENO_NO_UPDATE_CHECK=1"
105-
SET "QUARTO_DENO_OPTIONS=--unstable-kv --unstable-ffi --no-config --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi"
108+
SET "QUARTO_DENO_OPTIONS=--unstable-kv --unstable-ffi --no-config --no-lock --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi !QUARTO_DENO_OPTIONS!"
106109

107110
REM Add expected V8 options to QUARTO_DENO_V8_OPTIONS
108111
IF DEFINED QUARTO_DENO_V8_OPTIONS (

src/command/render/output.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export function outputRecipe(
181181
});
182182
}
183183

184-
if (!recipe.output) {
184+
const deriveAutoOutput = () => {
185185
// no output specified: derive an output path from the extension
186186

187187
// derive new output file
@@ -200,15 +200,16 @@ export function outputRecipe(
200200

201201
// assign output
202202
updateOutput(output);
203+
};
204+
205+
if (!recipe.output) {
206+
deriveAutoOutput();
203207
} else if (recipe.output === kStdOut) {
204-
// output to stdout: direct pandoc to write to a temp file then we'll
205-
// forward to stdout (necessary b/c a postprocesor may need to act on
206-
// the output before its complete)
207-
updateOutput(options.services.temp.createFile({ suffix: "." + ext }));
208+
deriveAutoOutput();
208209
recipe.isOutputTransient = true;
209210
completeActions.push(() => {
210-
writeFileToStdout(recipe.output);
211-
Deno.removeSync(recipe.output);
211+
writeFileToStdout(join(inputDir, recipe.output));
212+
Deno.removeSync(join(inputDir, recipe.output));
212213
});
213214
} else if (!isAbsolute(recipe.output)) {
214215
// relatve output file on the command line: make it relative to the input dir

src/command/render/render.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,25 +276,38 @@ export async function renderPandoc(
276276
await withTimingAsync("postprocess-selfcontained", async () => {
277277
// ensure flags
278278
const flags = context.options.flags || {};
279-
280-
// call complete handler (might e.g. run latexmk to complete the render)
281-
finalOutput = await recipe.complete(pandocOptions) || recipe.output;
282-
283279
// determine whether this is self-contained output
280+
finalOutput = recipe.output;
281+
282+
// note that we intentionally call isSelfContainedOutput twice
283+
// the first needs to happen before recipe completion
284+
// because ingestion of self-contained output needs
285+
// to happen before recipe completion (which cleans up some files)
284286
selfContained = isSelfContainedOutput(
285287
flags,
286288
format,
287289
finalOutput,
288290
);
289291

290-
// If this is self-contained, run pandoc to 'suck in' the dependencies
291-
// which may have been added in the post processor
292292
if (selfContained && isHtmlFileOutput(format.pandoc)) {
293293
await pandocIngestSelfContainedContent(
294294
outputFile,
295295
format.pandoc[kResourcePath],
296296
);
297297
}
298+
299+
// call complete handler (might e.g. run latexmk to complete the render)
300+
finalOutput = (await recipe.complete(pandocOptions)) || recipe.output;
301+
302+
// note that we intentionally call isSelfContainedOutput twice
303+
// the second call happens because some recipes change
304+
// their output extension on completion (notably, .pdf files)
305+
// and become self-contained for purposes of cleanup
306+
selfContained = isSelfContainedOutput(
307+
flags,
308+
format,
309+
finalOutput,
310+
);
298311
});
299312

300313
// compute the relative path to the files dir

src/core/sass.ts

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -139,36 +139,19 @@ export async function compileSass(
139139
...userRules,
140140
'// quarto-scss-analysis-annotation { "origin": null }',
141141
].join("\n\n");
142-
let failed = false;
143-
// deno-lint-ignore no-explicit-any
144-
let e: any = null;
145-
try {
146-
scssInput += "\n" + cssVarsBlock(scssInput);
147-
} catch (_e) {
148-
e = _e;
149-
failed = true;
150-
}
151142

152143
// Compile the scss
153144
const result = await compileWithCache(
154145
scssInput,
155146
loadPaths,
156147
temp,
157-
minified,
158-
await md5HashBytes(new TextEncoder().encode(scssInput)),
148+
{
149+
compressed: minified,
150+
cacheIdentifier: await md5HashBytes(new TextEncoder().encode(scssInput)),
151+
addVarsBlock: true,
152+
},
159153
);
160154

161-
if (failed) {
162-
console.warn("Error adding css vars block", e);
163-
console.warn(
164-
"The resulting CSS file will not have SCSS color variables exported as CSS.",
165-
);
166-
Deno.writeTextFileSync("_quarto_internal_scss_error.scss", scssInput);
167-
console.warn(
168-
"This is likely a Quarto bug.\nPlease consider reporting it at https://github.com/quarto-dev/quarto-cli,\nalong with the _quarto_internal_scss_error.scss file that can be found in the current working directory.",
169-
);
170-
}
171-
172155
if (!Deno.env.get("QUARTO_SAVE_SCSS")) {
173156
return result;
174157
}
@@ -353,13 +336,44 @@ export function sassLayerDir(
353336
};
354337
}
355338

339+
type CompileWithCacheOptions = {
340+
compressed?: boolean;
341+
cacheIdentifier?: string;
342+
addVarsBlock?: boolean;
343+
};
344+
356345
export async function compileWithCache(
357346
input: string,
358347
loadPaths: string[],
359348
temp: TempContext,
360-
compressed?: boolean,
361-
cacheIdentifier?: string,
349+
options?: CompileWithCacheOptions,
362350
) {
351+
const {
352+
compressed,
353+
cacheIdentifier,
354+
addVarsBlock,
355+
} = options || {};
356+
357+
const handleVarsBlock = (input: string) => {
358+
if (!addVarsBlock) {
359+
return input;
360+
}
361+
try {
362+
input += "\n" + cssVarsBlock(input);
363+
} catch (e) {
364+
console.warn("Error adding css vars block", e);
365+
console.warn(
366+
"The resulting CSS file will not have SCSS color variables exported as CSS.",
367+
);
368+
Deno.writeTextFileSync("_quarto_internal_scss_error.scss", input);
369+
console.warn(
370+
"This is likely a Quarto bug.\nPlease consider reporting it at https://github.com/quarto-dev/quarto-cli,\nalong with the _quarto_internal_scss_error.scss file that can be found in the current working directory.",
371+
);
372+
throw e;
373+
}
374+
return input;
375+
};
376+
363377
if (cacheIdentifier) {
364378
// If there are imports, the computed input Hash is incorrect
365379
// so we should be using a session cache which will cache
@@ -372,8 +386,16 @@ export async function compileWithCache(
372386
: quartoCacheDir("sass");
373387
// when using quarto session cache, we ensure to cleanup the cache files at TempContext cleanup
374388
const cache = await sassCache(cacheDir, useSessionCache ? temp : undefined);
375-
return cache.getOrSet(input, loadPaths, temp, cacheIdentifier, compressed);
389+
return cache.getOrSet(
390+
input,
391+
cacheIdentifier,
392+
async (outputFilePath: string) => {
393+
input = handleVarsBlock(input);
394+
await dartCompile(input, outputFilePath, temp, loadPaths, compressed);
395+
},
396+
);
376397
} else {
398+
input = handleVarsBlock(input);
377399
const outputFilePath = temp.createFile({ suffix: ".css" });
378400
// Skip the cache and just compile
379401
await dartCompile(

src/core/sass/cache.ts

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,13 @@ class SassCache {
7777
async setFromHash(
7878
identifierHash: string,
7979
inputHash: string,
80-
input: string,
81-
loadPaths: string[],
82-
temp: TempContext,
8380
cacheIdentifier: string,
84-
compressed?: boolean,
81+
compilationThunk: (outputFilePath: string) => Promise<void>,
8582
): Promise<string> {
8683
log.debug(`SassCache.setFromHash(${identifierHash}, ${inputHash}), ...`);
8784
const outputFilePath = join(this.path, `${identifierHash}.css`);
8885
try {
89-
await dartCompile(
90-
input,
91-
outputFilePath,
92-
temp,
93-
loadPaths,
94-
compressed,
95-
);
86+
await compilationThunk(outputFilePath);
9687
} catch (error) {
9788
// Compilation failed, so clear out the output file (if exists)
9889
// which will be invalid CSS
@@ -112,30 +103,23 @@ class SassCache {
112103

113104
async set(
114105
input: string,
115-
loadPaths: string[],
116-
temp: TempContext,
117106
cacheIdentifier: string,
118-
compressed?: boolean,
107+
compilationThunk: (outputFilePath: string) => Promise<void>,
119108
): Promise<string> {
120109
const identifierHash = md5Hash(cacheIdentifier);
121110
const inputHash = md5Hash(input);
122111
return this.setFromHash(
123112
identifierHash,
124113
inputHash,
125-
input,
126-
loadPaths,
127-
temp,
128114
cacheIdentifier,
129-
compressed,
115+
compilationThunk,
130116
);
131117
}
132118

133119
async getOrSet(
134120
input: string,
135-
loadPaths: string[],
136-
temp: TempContext,
137121
cacheIdentifier: string,
138-
compressed?: boolean,
122+
compilationThunk: (outputFilePath: string) => Promise<void>,
139123
): Promise<string> {
140124
log.debug(`SassCache.getOrSet(...)`);
141125
const identifierHash = md5Hash(cacheIdentifier);
@@ -149,11 +133,8 @@ class SassCache {
149133
return this.setFromHash(
150134
identifierHash,
151135
inputHash,
152-
input,
153-
loadPaths,
154-
temp,
155136
cacheIdentifier,
156-
compressed,
137+
compilationThunk,
157138
);
158139
}
159140

0 commit comments

Comments
 (0)