Skip to content

Commit b57d867

Browse files
committed
Validate document-level column, fig-column and tbl-column
`column`, `fig-column` and `tbl-column` are read from document metadata by columns-preprocess.lua, but the front matter schema is built only from fields tagged with a `document-*` context. These three options in cell-pagelayout.yml had no tags, so front matter accepted any value silently and offered no completion. Tag them like their `*-cap-location` siblings. The format list matches what columns.lua handles (HTML, LaTeX, Typst). Cell-level use is unchanged. Fixes #15325
1 parent 9777eda commit b57d867

7 files changed

Lines changed: 147 additions & 10 deletions

File tree

‎news/changelog-1.12.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ All changes included in 1.12:
6363
- ([#15268](https://github.com/quarto-dev/quarto-cli/issues/15268)): Translate the `skip-to-content` language key in Bulgarian, Catalan, Czech, Danish, Finnish, Hebrew, Indonesian, Korean, Lithuanian, Norwegian Bokmål, Norwegian Nynorsk, Polish, Russian, Serbian (Latin), Slovak, Slovenian, Swedish, Turkish and Ukrainian, using reviewed machine translation.
6464
- ([#15271](https://github.com/quarto-dev/quarto-cli/issues/15271)): Translate the `tools-share` and `tools-download` language keys in Catalan, Chinese, Czech, Danish, Dutch, Finnish, French, German, Hebrew, Indonesian, Italian, Japanese, Korean, Lithuanian, Norwegian Bokmål, Norwegian Nynorsk, Polish, Portuguese, Russian, Slovak, Swedish, Turkish and Ukrainian, and `tools-share` in Serbian (Latin), using reviewed machine translation.
6565
- ([#15289](https://github.com/quarto-dev/quarto-cli/issues/15289)): Translate the `announcement-dismiss-label` language key, the accessible name of the close button of a website announcement, in Azerbaijani, Basque, Bulgarian, Catalan, Chinese (Simplified and Traditional), Czech, Dutch, Finnish, French, German, Hebrew, Icelandic, Indonesian, Italian, Japanese, Korean, Lithuanian, Norwegian Nynorsk, Polish, Portuguese, Russian, Serbian (Latin), Slovak, Slovenian, Spanish, Swedish, Turkish and Ukrainian, using reviewed machine translation.
66+
- ([#15325](https://github.com/quarto-dev/quarto-cli/issues/15325)): Validate and offer completion for `column`, `fig-column` and `tbl-column` in document front matter. They already took effect there, but an invalid value was silently accepted.

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

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8000,6 +8000,16 @@ var init_yaml_intelligence_resources = __esm({
80008000
"schema/cell-pagelayout.yml": [
80018001
{
80028002
name: "column",
8003+
tags: {
8004+
contexts: [
8005+
"document-layout"
8006+
],
8007+
formats: [
8008+
"$html-files",
8009+
"$pdf-all",
8010+
"typst"
8011+
]
8012+
},
80038013
schema: {
80048014
ref: "page-column"
80058015
},
@@ -8010,6 +8020,17 @@ var init_yaml_intelligence_resources = __esm({
80108020
},
80118021
{
80128022
name: "fig-column",
8023+
tags: {
8024+
contexts: [
8025+
"document-layout",
8026+
"document-figures"
8027+
],
8028+
formats: [
8029+
"$html-files",
8030+
"$pdf-all",
8031+
"typst"
8032+
]
8033+
},
80138034
schema: {
80148035
ref: "page-column"
80158036
},
@@ -8020,6 +8041,17 @@ var init_yaml_intelligence_resources = __esm({
80208041
},
80218042
{
80228043
name: "tbl-column",
8044+
tags: {
8045+
contexts: [
8046+
"document-layout",
8047+
"document-tables"
8048+
],
8049+
formats: [
8050+
"$html-files",
8051+
"$pdf-all",
8052+
"typst"
8053+
]
8054+
},
80238055
schema: {
80248056
ref: "page-column"
80258057
},
@@ -25877,12 +25909,12 @@ var init_yaml_intelligence_resources = __esm({
2587725909
mermaid: "%%"
2587825910
},
2587925911
"handlers/mermaid/schema.yml": {
25880-
_internalId: 222271,
25912+
_internalId: 222313,
2588125913
type: "object",
2588225914
description: "be an object",
2588325915
properties: {
2588425916
"mermaid-format": {
25885-
_internalId: 222263,
25917+
_internalId: 222305,
2588625918
type: "enum",
2588725919
enum: [
2588825920
"png",
@@ -25898,7 +25930,7 @@ var init_yaml_intelligence_resources = __esm({
2589825930
exhaustiveCompletions: true
2589925931
},
2590025932
theme: {
25901-
_internalId: 222270,
25933+
_internalId: 222312,
2590225934
type: "anyOf",
2590325935
anyOf: [
2590425936
{

‎src/resources/editor/tools/yaml/all-schema-definitions.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

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

Lines changed: 35 additions & 3 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: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,16 @@
973973
"schema/cell-pagelayout.yml": [
974974
{
975975
"name": "column",
976+
"tags": {
977+
"contexts": [
978+
"document-layout"
979+
],
980+
"formats": [
981+
"$html-files",
982+
"$pdf-all",
983+
"typst"
984+
]
985+
},
976986
"schema": {
977987
"ref": "page-column"
978988
},
@@ -983,6 +993,17 @@
983993
},
984994
{
985995
"name": "fig-column",
996+
"tags": {
997+
"contexts": [
998+
"document-layout",
999+
"document-figures"
1000+
],
1001+
"formats": [
1002+
"$html-files",
1003+
"$pdf-all",
1004+
"typst"
1005+
]
1006+
},
9861007
"schema": {
9871008
"ref": "page-column"
9881009
},
@@ -993,6 +1014,17 @@
9931014
},
9941015
{
9951016
"name": "tbl-column",
1017+
"tags": {
1018+
"contexts": [
1019+
"document-layout",
1020+
"document-tables"
1021+
],
1022+
"formats": [
1023+
"$html-files",
1024+
"$pdf-all",
1025+
"typst"
1026+
]
1027+
},
9961028
"schema": {
9971029
"ref": "page-column"
9981030
},
@@ -18850,12 +18882,12 @@
1885018882
"mermaid": "%%"
1885118883
},
1885218884
"handlers/mermaid/schema.yml": {
18853-
"_internalId": 222271,
18885+
"_internalId": 222313,
1885418886
"type": "object",
1885518887
"description": "be an object",
1885618888
"properties": {
1885718889
"mermaid-format": {
18858-
"_internalId": 222263,
18890+
"_internalId": 222305,
1885918891
"type": "enum",
1886018892
"enum": [
1886118893
"png",
@@ -18871,7 +18903,7 @@
1887118903
"exhaustiveCompletions": true
1887218904
},
1887318905
"theme": {
18874-
"_internalId": 222270,
18906+
"_internalId": 222312,
1887518907
"type": "anyOf",
1887618908
"anyOf": [
1887718909
{

‎src/resources/schema/cell-pagelayout.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
- name: column
2+
tags:
3+
contexts: [document-layout]
4+
formats: [$html-files, $pdf-all, typst]
25
schema:
36
ref: page-column
47
description:
58
short: "Page column for output"
69
long: "[Page column](https://quarto.org/docs/authoring/article-layout.html) for output"
710

811
- name: fig-column
12+
tags:
13+
contexts: [document-layout, document-figures]
14+
formats: [$html-files, $pdf-all, typst]
915
schema:
1016
ref: page-column
1117
description:
1218
short: "Page column for figure output"
1319
long: "[Page column](https://quarto.org/docs/authoring/article-layout.html) for figure output"
1420

1521
- name: tbl-column
22+
tags:
23+
contexts: [document-layout, document-tables]
24+
formats: [$html-files, $pdf-all, typst]
1625
schema:
1726
ref: page-column
1827
description:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* front-matter-page-column.test.ts
3+
*
4+
* Copyright (C) 2026 Posit Software, PBC
5+
*/
6+
7+
import { assertEquals } from "../../asserts.ts";
8+
import { yamlValidationUnitTest } from "./utils.ts";
9+
import { getFrontMatterSchema } from "../../../src/core/lib/yaml-schema/front-matter.ts";
10+
import { readAndValidateYamlFromMappedString } from "../../../src/core/lib/yaml-schema/validated-yaml.ts";
11+
import { asMappedString } from "../../../src/core/lib/mapped-text.ts";
12+
13+
const cases: [string, string, boolean][] = [
14+
["column invalid", "column: banana\n", false],
15+
["column valid", "column: margin\n", true],
16+
["fig-column invalid", "fig-column: banana\n", false],
17+
["fig-column valid", "fig-column: page\n", true],
18+
["tbl-column invalid", "tbl-column: banana\n", false],
19+
["tbl-column valid", "tbl-column: screen-inset\n", true],
20+
];
21+
22+
for (const [name, yaml, valid] of cases) {
23+
yamlValidationUnitTest(`front matter ${name}`, async () => {
24+
const schema = await getFrontMatterSchema();
25+
const { yamlValidationErrors } = await readAndValidateYamlFromMappedString(
26+
asMappedString(`title: Page\n${yaml}`),
27+
schema,
28+
);
29+
assertEquals(yamlValidationErrors.length === 0, valid, yaml);
30+
});
31+
}

0 commit comments

Comments
 (0)