Skip to content

Commit 08cb7be

Browse files
committed
Merge branch 'main' into fix/page-inset-completions
2 parents 0dd4582 + 3078c2f commit 08cb7be

File tree

19 files changed

+1308
-1415
lines changed

19 files changed

+1308
-1415
lines changed

news/changelog-1.7.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ All changes included in 1.7:
140140

141141
### `jupyter`
142142

143+
- ([#9089](https://github.com/quarto-dev/quarto-cli/issues/9089)): Compound jupyter metadata is now serialized into a special key-value attribute to not break Pandoc's fenced div parsing.
143144
- ([#12114](https://github.com/quarto-dev/quarto-cli/issues/12114)): `JUPYTERCACHE` environment variable from [Jupyter cache CLI](https://jupyter-cache.readthedocs.io/en/latest/using/cli.html) is now respected by Quarto when `cache: true` is used. This environment variable allows to change the path of the cache directory.
144145
- ([#12374](https://github.com/quarto-dev/quarto-cli/issues/12374)): Detect language properly in Jupyter notebooks that lack the `language` field in their `kernelspec`s.
145146
- ([#12228](https://github.com/quarto-dev/quarto-cli/issues/12228)): `quarto render` will now fails if errors are detected at IPython display level. Setting `error: true` globally or at cell level will keep the error to show in output and not stop the rendering.
@@ -164,6 +165,7 @@ All changes included in 1.7:
164165
- ([#12338](https://github.com/quarto-dev/quarto-cli/issues/12338)): Add an additional workaround for the SCSS parser used in color variable extraction.
165166
- ([#12369](https://github.com/quarto-dev/quarto-cli/pull/12369)): `quarto preview` correctly throws a YAML validation error when a `format` key does not conform.
166167
- ([#12238](https://gijit.com/quarto-dev/quarto-cli/issues/12238)): Very long error (e.g. in Jupyter Notenook with backtrace) are now no more truncated in the console.
168+
- ([#9867](https://github.com/quarto-dev/quarto-cli/issues/9867)): Blank lines are now trimmed in Raw HTML Table blocks.
167169

168170
## Languages
169171

src/command/convert/jupyter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ export async function jupyterNotebookToMarkdown(
132132
}
133133
}
134134

135-
console.log({ md });
136-
137135
// join into source
138136
const mdSource = md.join("");
139137

src/command/list/cmd.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { outputTools } from "../../tools/tools-console.ts";
1717
import { notebookContext } from "../../render/notebook/notebook-context.ts";
1818

1919
export const listCommand = new Command()
20-
.hidden()
2120
.name("list")
2221
.arguments("<type:string>")
2322
.description(

src/core/jupyter/jupyter.ts

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ import {
174174
jupyterCellSrcAsLines,
175175
jupyterCellSrcAsStr,
176176
} from "./jupyter-shared.ts";
177+
import { error } from "../../deno_ral/log.ts";
178+
import { valid } from "semver/mod.ts";
177179

178180
export const kQuartoMimeType = "quarto_mimetype";
179181
export const kQuartoOutputOrder = "quarto_order";
@@ -921,8 +923,44 @@ export function jupyterCellWithOptions(
921923
}
922924
};
923925

926+
const validMetadata: Record<
927+
string,
928+
string | number | boolean | null | Array<unknown>
929+
> = {};
930+
for (const key of Object.keys(cell.metadata)) {
931+
const value = cell.metadata[key];
932+
let jsonEncodedKeyIndex = 0;
933+
if (value !== undefined) {
934+
if (!value && typeof value === "object") {
935+
validMetadata[key] = null;
936+
} else if (value && typeof value === "object" && !Array.isArray(value)) {
937+
// https://github.com/quarto-dev/quarto-cli/issues/9089
938+
// we need to json-encode this and signal the encoding in the key
939+
// we can't use the key as is since it may contain invalid characters
940+
// and modifying the key might introduce collisions
941+
// we ensure the key is unique with a counter, and assume
942+
// "quarto-private-*" to be a private namespace for quarto.
943+
// we'd prefer to use _quarto-* instead, but Pandoc doesn't allow keys to start
944+
// with an underscore.
945+
validMetadata[
946+
`quarto-private-${++jsonEncodedKeyIndex}`
947+
] = JSON.stringify({ key, value });
948+
} else if (
949+
typeof value === "string" || typeof value === "number" ||
950+
typeof value === "boolean" || Array.isArray(value)
951+
) {
952+
validMetadata[key] = value;
953+
} else {
954+
error(
955+
`Invalid metadata type for key ${key}: ${typeof value}. Entry will not be serialized.`,
956+
);
957+
}
958+
}
959+
}
960+
924961
return {
925962
...cell,
963+
metadata: validMetadata,
926964
id: cellId(cell),
927965
source,
928966
optionsSource,
@@ -1766,7 +1804,10 @@ function isMarkdown(output: JupyterOutput, options: JupyterToMarkdownOptions) {
17661804
return isDisplayDataType(output, options, displayDataIsMarkdown);
17671805
}
17681806

1769-
async function mdOutputStream(output: JupyterOutputStream, options: JupyterToMarkdownOptions) {
1807+
async function mdOutputStream(
1808+
output: JupyterOutputStream,
1809+
options: JupyterToMarkdownOptions,
1810+
) {
17701811
let text: string[] = [];
17711812
if (typeof output.text === "string") {
17721813
text = [output.text];
@@ -1873,8 +1914,11 @@ async function mdOutputDisplayData(
18731914
// if output is invalid, warn and emit empty
18741915
const data = output.data[mimeType] as unknown;
18751916
if (!Array.isArray(data) || data.some((s) => typeof s !== "string")) {
1876-
return await mdWarningOutput(`Unable to process text plain output data
1877-
which does not appear to be plain text: ${JSON.stringify(data)}`, options);
1917+
return await mdWarningOutput(
1918+
`Unable to process text plain output data
1919+
which does not appear to be plain text: ${JSON.stringify(data)}`,
1920+
options,
1921+
);
18781922
}
18791923
const lines = data as string[];
18801924
// pandas inexplicably outputs html tables as text/plain with an enclosing single-quote
@@ -1911,7 +1955,7 @@ which does not appear to be plain text: ${JSON.stringify(data)}`, options);
19111955
// no type match found
19121956
return await mdWarningOutput(
19131957
"Unable to display output for mime type(s): " +
1914-
Object.keys(output.data).join(", "),
1958+
Object.keys(output.data).join(", "),
19151959
options,
19161960
);
19171961
}

src/core/pandoc/self-contained.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ export const pandocIngestSelfContainedContent = async (
4848

4949
// The raw html contents
5050
const contents = Deno.readTextFileSync(file);
51+
const doctypeMatch = contents.match(/^<!DOCTYPE.*?>/);
5152
const dom = await parseHtml(contents);
5253
await bundleModules(dom, workingDir);
5354

5455
const input: string[] = [];
5556
input.push("````````{=html}");
57+
if (doctypeMatch) {
58+
input.push(doctypeMatch[0]);
59+
}
5660
input.push(dom.documentElement!.outerHTML);
5761
input.push("````````");
5862

src/resources/editor/tools/vs-code.mjs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7046,7 +7046,7 @@ var require_yaml_intelligence_resources = __commonJS({
70467046
schema: {
70477047
arrayOf: "string"
70487048
},
7049-
description: "Array of rendering names"
7049+
description: "Array of rendering names, e.g. `[light, dark]`"
70507050
},
70517051
{
70527052
name: "tags",
@@ -16879,8 +16879,8 @@ var require_yaml_intelligence_resources = __commonJS({
1687916879
]
1688016880
},
1688116881
description: {
16882-
short: "Whether the `prefers-color-scheme` media query controls dark mode.",
16883-
long: "Whether to use the `prefers-color-scheme` media query to determine whether to show\nthe user a dark or light page. Otherwise the author preference (order of `light`\nand `dark` in `theme` or `brand`) determines what is shown to the user at first visit.\n"
16882+
short: "Enables setting dark mode based on the `prefers-color-scheme` media query.",
16883+
long: "If set, Quarto reads the `prefers-color-scheme` media query to determine whether to show\nthe user a dark or light page. Otherwise the author-preferred color scheme is shown.\n"
1688416884
}
1688516885
},
1688616886
{
@@ -22964,6 +22964,10 @@ var require_yaml_intelligence_resources = __commonJS({
2296422964
"Enables hover over a section title to see an anchor link.",
2296522965
"Enables tabsets to present content.",
2296622966
"Enables smooth scrolling within the page.",
22967+
{
22968+
short: "Whether the <code>prefers-color-scheme</code> media query controls\ndark mode.",
22969+
long: "Whether to use the <code>prefers-color-scheme</code> media query to\ndetermine whether to show the user a dark or light page. Otherwise the\nauthor preference (order of <code>light</code> and <code>dark</code> in\n<code>theme</code> or <code>brand</code>) determines what is shown to\nthe user at first visit."
22970+
},
2296722971
{
2296822972
short: "Method use to render math in HTML output",
2296922973
long: 'Method use to render math in HTML output (<code>plain</code>,\n<code>webtex</code>, <code>gladtex</code>, <code>mathml</code>,\n<code>mathjax</code>, <code>katex</code>).\nSee the Pandoc documentation on <a href="https://pandoc.org/MANUAL.html#math-rendering-in-html">Math\nRendering in HTML</a> for additional details.'
@@ -24057,11 +24061,7 @@ var require_yaml_intelligence_resources = __commonJS({
2405724061
"Disambiguating year suffix in author-date styles (e.g.&nbsp;\u201Ca\u201D in \u201CDoe,\n1999a\u201D).",
2405824062
"Manuscript configuration",
2405924063
"internal-schema-hack",
24060-
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.",
24061-
{
24062-
short: "Whether the <code>prefers-color-scheme</code> media query controls\ndark mode.",
24063-
long: "Whether to use the <code>prefers-color-scheme</code> media query to\ndetermine whether to show the user a dark or light page. Otherwise the\nauthor preference (order of <code>light</code> and <code>dark</code> in\n<code>theme</code> or <code>brand</code>) determines what is shown to\nthe user at first visit."
24064-
}
24064+
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019."
2406524065
],
2406624066
"schema/external-schemas.yml": [
2406724067
{
@@ -24290,12 +24290,12 @@ var require_yaml_intelligence_resources = __commonJS({
2429024290
mermaid: "%%"
2429124291
},
2429224292
"handlers/mermaid/schema.yml": {
24293-
_internalId: 194479,
24293+
_internalId: 194627,
2429424294
type: "object",
2429524295
description: "be an object",
2429624296
properties: {
2429724297
"mermaid-format": {
24298-
_internalId: 194471,
24298+
_internalId: 194619,
2429924299
type: "enum",
2430024300
enum: [
2430124301
"png",
@@ -24311,7 +24311,7 @@ var require_yaml_intelligence_resources = __commonJS({
2431124311
exhaustiveCompletions: true
2431224312
},
2431324313
theme: {
24314-
_internalId: 194478,
24314+
_internalId: 194626,
2431524315
type: "anyOf",
2431624316
anyOf: [
2431724317
{

src/resources/editor/tools/yaml/web-worker.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/editor/tools/yaml/yaml-intelligence-resources.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"schema": {
1919
"arrayOf": "string"
2020
},
21-
"description": "Array of rendering names"
21+
"description": "Array of rendering names, e.g. `[light, dark]`"
2222
},
2323
{
2424
"name": "tags",
@@ -9851,8 +9851,8 @@
98519851
]
98529852
},
98539853
"description": {
9854-
"short": "Whether the `prefers-color-scheme` media query controls dark mode.",
9855-
"long": "Whether to use the `prefers-color-scheme` media query to determine whether to show\nthe user a dark or light page. Otherwise the author preference (order of `light`\nand `dark` in `theme` or `brand`) determines what is shown to the user at first visit.\n"
9854+
"short": "Enables setting dark mode based on the `prefers-color-scheme` media query.",
9855+
"long": "If set, Quarto reads the `prefers-color-scheme` media query to determine whether to show\nthe user a dark or light page. Otherwise the author-preferred color scheme is shown.\n"
98569856
}
98579857
},
98589858
{
@@ -15936,6 +15936,10 @@
1593615936
"Enables hover over a section title to see an anchor link.",
1593715937
"Enables tabsets to present content.",
1593815938
"Enables smooth scrolling within the page.",
15939+
{
15940+
"short": "Whether the <code>prefers-color-scheme</code> media query controls\ndark mode.",
15941+
"long": "Whether to use the <code>prefers-color-scheme</code> media query to\ndetermine whether to show the user a dark or light page. Otherwise the\nauthor preference (order of <code>light</code> and <code>dark</code> in\n<code>theme</code> or <code>brand</code>) determines what is shown to\nthe user at first visit."
15942+
},
1593915943
{
1594015944
"short": "Method use to render math in HTML output",
1594115945
"long": "Method use to render math in HTML output (<code>plain</code>,\n<code>webtex</code>, <code>gladtex</code>, <code>mathml</code>,\n<code>mathjax</code>, <code>katex</code>).\nSee the Pandoc documentation on <a href=\"https://pandoc.org/MANUAL.html#math-rendering-in-html\">Math\nRendering in HTML</a> for additional details."
@@ -17029,11 +17033,7 @@
1702917033
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“a” in “Doe,\n1999a”).",
1703017034
"Manuscript configuration",
1703117035
"internal-schema-hack",
17032-
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’.",
17033-
{
17034-
"short": "Whether the <code>prefers-color-scheme</code> media query controls\ndark mode.",
17035-
"long": "Whether to use the <code>prefers-color-scheme</code> media query to\ndetermine whether to show the user a dark or light page. Otherwise the\nauthor preference (order of <code>light</code> and <code>dark</code> in\n<code>theme</code> or <code>brand</code>) determines what is shown to\nthe user at first visit."
17036-
}
17036+
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’."
1703717037
],
1703817038
"schema/external-schemas.yml": [
1703917039
{
@@ -17262,12 +17262,12 @@
1726217262
"mermaid": "%%"
1726317263
},
1726417264
"handlers/mermaid/schema.yml": {
17265-
"_internalId": 194479,
17265+
"_internalId": 194627,
1726617266
"type": "object",
1726717267
"description": "be an object",
1726817268
"properties": {
1726917269
"mermaid-format": {
17270-
"_internalId": 194471,
17270+
"_internalId": 194619,
1727117271
"type": "enum",
1727217272
"enum": [
1727317273
"png",
@@ -17283,7 +17283,7 @@
1728317283
"exhaustiveCompletions": true
1728417284
},
1728517285
"theme": {
17286-
"_internalId": 194478,
17286+
"_internalId": 194626,
1728717287
"type": "anyOf",
1728817288
"anyOf": [
1728917289
{

src/resources/filters/crossref/crossref.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import("../quarto-init/resourcerefs.lua")
6161

6262
import("../normalize/flags.lua")
6363
import("../normalize/normalize.lua")
64-
import("../normalize/parsehtml.lua")
6564
import("../normalize/extractquartodom.lua")
6665
import("../normalize/astpipeline.lua")
6766
import("../normalize/capturereaderstate.lua")

src/resources/filters/main.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ import("./quarto-finalize/typst.lua")
100100

101101
import("./normalize/flags.lua")
102102
import("./normalize/normalize.lua")
103-
import("./normalize/parsehtml.lua")
104103
import("./normalize/extractquartodom.lua")
105104
import("./normalize/astpipeline.lua")
106105
import("./normalize/capturereaderstate.lua")

0 commit comments

Comments
 (0)