Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions news/changelog-1.12.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ All changes included in 1.12:

- ([#15251](https://github.com/quarto-dev/quarto-cli/pull/15251)): Fix algorithm blocks (`#alg-`) being set in italics. Their body is now upright, like definitions, examples and exercises. (author: @mcanouil)

### `revealjs`

- ([#7378](https://github.com/quarto-dev/quarto-cli/issues/7378)): Add `code-line-fragment-indices` to set the fragment index of each step of stepped `code-line-numbers` highlighting. (author: @mcanouil)

### `typst`

- ([#15168](https://github.com/quarto-dev/quarto-cli/issues/15168)): Fix definitions, examples and exercises being set in italics in Typst output with the default `theorem-appearance: simple`. Their body is now upright, as in LaTeX output, while theorems, lemmas, corollaries, propositions and conjectures keep an italic body. (author: @mcanouil)
Expand Down
1 change: 1 addition & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const kFigEnv = "fig-env";
export const kFigPos = "fig-pos";
export const kCodeFold = "code-fold";
export const kCodeLineNumbers = "code-line-numbers";
export const kCodeLineFragmentIndices = "code-line-fragment-indices";
export const kCodeOverflow = "code-overflow";
export const kCodeLink = "code-link";
export const kCodeTools = "code-tools";
Expand Down
2 changes: 2 additions & 0 deletions src/core/handlers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
kCellPanel,
kCellTblColumn,
kCodeFold,
kCodeLineFragmentIndices,
kCodeLineNumbers,
kCodeOverflow,
kCodeSummary,
Expand Down Expand Up @@ -807,6 +808,7 @@ export function getDivAttributes(
kCellLstLabel,
kCodeFold,
kCodeLineNumbers,
kCodeLineFragmentIndices,
kCodeSummary,
kCodeOverflow,
kCellClasses,
Expand Down
9 changes: 9 additions & 0 deletions src/core/jupyter/jupyter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import {
kCellTblColumn,
kCellWidth,
kCodeFold,
kCodeLineFragmentIndices,
kCodeLineNumbers,
kCodeOverflow,
kCodeSummary,
Expand Down Expand Up @@ -228,6 +229,7 @@ export const kJupyterCellInternalOptionKeys = [
kCellMdIndent,
kCodeFold,
kCodeLineNumbers,
kCodeLineFragmentIndices,
kCodeSummary,
kCodeOverflow,
kHtmlTableProcessing,
Expand Down Expand Up @@ -1508,6 +1510,13 @@ async function mdFromCodeCell(
if (typeof cell.options[kCodeLineNumbers] !== "undefined") {
md.push(` code-line-numbers=\"${cell.options[kCodeLineNumbers]}\"`);
}
if (typeof cell.options[kCodeLineFragmentIndices] !== "undefined") {
md.push(
` code-line-fragment-indices=\"${
[cell.options[kCodeLineFragmentIndices]].flat().join(",")
}\"`,
);
}
}
md.push("}\n");
let source = typeof cell.source === "string"
Expand Down
2 changes: 2 additions & 0 deletions src/core/jupyter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
kCellTblColumn,
kCellUserExpressions,
kCodeFold,
kCodeLineFragmentIndices,
kCodeLineNumbers,
kCodeOverflow,
kCodeSummary,
Expand Down Expand Up @@ -216,6 +217,7 @@ export interface JupyterCellOptions extends JupyterOutputFigureOptions {
[kCellColumn]?: string;
[kCodeFold]?: string;
[kCodeLineNumbers]?: boolean | string;
[kCodeLineFragmentIndices]?: string | number | number[];
[kCodeSummary]?: string;
[kCodeOverflow]?: string;
[kCellMdIndent]?: string;
Expand Down
9 changes: 9 additions & 0 deletions src/execute/ojs/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
kCellLstCap,
kCellLstLabel,
kCodeFold,
kCodeLineFragmentIndices,
kCodeLineNumbers,
kCodeOverflow,
kEcho,
Expand Down Expand Up @@ -517,6 +518,14 @@ export async function ojsCompile(
);
}

if (typeof cell.options?.[kCodeLineFragmentIndices] !== "undefined") {
srcAttrs.push(
`${kCodeLineFragmentIndices}="${
[cell.options?.[kCodeLineFragmentIndices]].flat().join(",")
}"`,
);
}

const srcConfig = {
classes: srcClasses.slice(),
attrs: srcAttrs.slice(),
Expand Down
2 changes: 2 additions & 0 deletions src/resources/editor/tools/attrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@
doc: Show line numbers for code block
- value: 'code-line-numbers="false"'
doc: Do not show line numbers for code block
- value: 'code-line-fragment-indices="$0"'
doc: Fragment index of each code line highlight step (Reveal.js only)
- value: 'shortcodes="false"'
doc: Do not process shortcodes in this code block

Expand Down
35 changes: 32 additions & 3 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7459,6 +7459,31 @@ var init_yaml_intelligence_resources = __esm({
long: "Include line numbers in code block output (`true` or `false`).\n\nFor revealjs output only, you can also specify a string to highlight\nspecific lines (and/or animate between sets of highlighted lines).\n\n* Sets of lines are denoted with commas:\n * `3,4,5`\n * `1,10,12`\n* Ranges can be denoted with dashes and combined with commas:\n * `1-3,5` \n * `5-10,12,14`\n* Finally, animation steps are separated by `|`:\n * `1-3|1-3,5` first shows `1-3`, then `1-3,5`\n * `|5|5-10,12` first shows no numbering, then 5, then lines 5-10\n and 12\n"
}
},
{
name: "code-line-fragment-indices",
tags: {
formats: [
"revealjs"
]
},
schema: {
anyOf: [
{
string: {
pattern: "^\\s*\\d+\\s*(,\\s*\\d+\\s*)*$"
}
},
{
maybeArrayOf: "number"
}
],
errorDescription: "be a non-negative integer, a list of them, or a comma-separated string of them, such as `1,2`"
},
description: {
short: "Fragment index of each step of stepped code-line-numbers highlighting (Reveal.js only).",
long: 'Fragment index of each step of stepped `code-line-numbers` highlighting\n(Reveal.js only).\n\nGive one index for each step after the first, as a comma-separated list\nof non-negative integers, a YAML list, or a single number.\nThe indices must be strictly increasing.\nEach value places its highlight step among the other fragments of the\nslide, in the same way as `fragment-index` on any other fragment.\nA lower value shows earlier.\nFor example, `code-line-numbers: "|1|2"` with\n`code-line-fragment-indices: "1,2"` shows line 1 at fragment index 1 and\nline 2 at fragment index 2.\n\nThe first step is the code block itself and is not a fragment.\nStart `code-line-numbers` with `|` to give the first highlight its own\nindex.\n\nThe number of indices must equal the number of steps minus one.\nIf it does not, or if the indices are not strictly increasing,\nthe list is ignored, a warning is printed, and the steps use\nthe default order.\n'
}
},
{
name: "lst-label",
schema: "string",
Expand Down Expand Up @@ -23555,6 +23580,10 @@ var init_yaml_intelligence_resources = __esm({
short: "Include line numbers in code block output (<code>true</code> or\n<code>false</code>)",
long: "Include line numbers in code block output (<code>true</code> or\n<code>false</code>).\nFor revealjs output only, you can also specify a string to highlight\nspecific lines (and/or animate between sets of highlighted lines)."
},
{
short: "Fragment index of each step of stepped code-line-numbers highlighting\n(Reveal.js only).",
long: 'Fragment index of each step of stepped <code>code-line-numbers</code>\nhighlighting (Reveal.js only).\nGive one index for each step after the first, as a comma-separated\nlist of non-negative integers, a YAML list, or a single number. The\nindices must be strictly increasing. Each value places its highlight\nstep among the other fragments of the slide, in the same way as\n<code>fragment-index</code> on any other fragment. A lower value shows\nearlier. For example, <code>code-line-numbers: "|1|2"</code> with\n<code>code-line-fragment-indices: "1,2"</code> shows line 1 at fragment\nindex 1 and line 2 at fragment index 2.\nThe first step is the code block itself and is not a fragment. Start\n<code>code-line-numbers</code> with <code>|</code> to give the first\nhighlight its own index.\nThe number of indices must equal the number of steps minus one. If it\ndoes not, or if the indices are not strictly increasing, the list is\nignored, a warning is printed, and the steps use the default order.'
},
"Unique label for code listing (used in cross references)",
"Caption for code listing",
"Whether to reformat R code.",
Expand Down Expand Up @@ -25848,12 +25877,12 @@ var init_yaml_intelligence_resources = __esm({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
_internalId: 221307,
_internalId: 222271,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
_internalId: 221299,
_internalId: 222263,
type: "enum",
enum: [
"png",
Expand All @@ -25869,7 +25898,7 @@ var init_yaml_intelligence_resources = __esm({
exhaustiveCompletions: true
},
theme: {
_internalId: 221306,
_internalId: 222270,
type: "anyOf",
anyOf: [
{
Expand Down

Large diffs are not rendered by default.

35 changes: 32 additions & 3 deletions src/resources/editor/tools/yaml/web-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 32 additions & 3 deletions src/resources/editor/tools/yaml/yaml-intelligence-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,31 @@
"long": "Include line numbers in code block output (`true` or `false`).\n\nFor revealjs output only, you can also specify a string to highlight\nspecific lines (and/or animate between sets of highlighted lines).\n\n* Sets of lines are denoted with commas:\n * `3,4,5`\n * `1,10,12`\n* Ranges can be denoted with dashes and combined with commas:\n * `1-3,5` \n * `5-10,12,14`\n* Finally, animation steps are separated by `|`:\n * `1-3|1-3,5` first shows `1-3`, then `1-3,5`\n * `|5|5-10,12` first shows no numbering, then 5, then lines 5-10\n and 12\n"
}
},
{
"name": "code-line-fragment-indices",
"tags": {
"formats": [
"revealjs"
]
},
"schema": {
"anyOf": [
{
"string": {
"pattern": "^\\s*\\d+\\s*(,\\s*\\d+\\s*)*$"
}
},
{
"maybeArrayOf": "number"
}
],
"errorDescription": "be a non-negative integer, a list of them, or a comma-separated string of them, such as `1,2`"
},
"description": {
"short": "Fragment index of each step of stepped code-line-numbers highlighting (Reveal.js only).",
"long": "Fragment index of each step of stepped `code-line-numbers` highlighting\n(Reveal.js only).\n\nGive one index for each step after the first, as a comma-separated list\nof non-negative integers, a YAML list, or a single number.\nThe indices must be strictly increasing.\nEach value places its highlight step among the other fragments of the\nslide, in the same way as `fragment-index` on any other fragment.\nA lower value shows earlier.\nFor example, `code-line-numbers: \"|1|2\"` with\n`code-line-fragment-indices: \"1,2\"` shows line 1 at fragment index 1 and\nline 2 at fragment index 2.\n\nThe first step is the code block itself and is not a fragment.\nStart `code-line-numbers` with `|` to give the first highlight its own\nindex.\n\nThe number of indices must equal the number of steps minus one.\nIf it does not, or if the indices are not strictly increasing,\nthe list is ignored, a warning is printed, and the steps use\nthe default order.\n"
}
},
{
"name": "lst-label",
"schema": "string",
Expand Down Expand Up @@ -16528,6 +16553,10 @@
"short": "Include line numbers in code block output (<code>true</code> or\n<code>false</code>)",
"long": "Include line numbers in code block output (<code>true</code> or\n<code>false</code>).\nFor revealjs output only, you can also specify a string to highlight\nspecific lines (and/or animate between sets of highlighted lines)."
},
{
"short": "Fragment index of each step of stepped code-line-numbers highlighting\n(Reveal.js only).",
"long": "Fragment index of each step of stepped <code>code-line-numbers</code>\nhighlighting (Reveal.js only).\nGive one index for each step after the first, as a comma-separated\nlist of non-negative integers, a YAML list, or a single number. The\nindices must be strictly increasing. Each value places its highlight\nstep among the other fragments of the slide, in the same way as\n<code>fragment-index</code> on any other fragment. A lower value shows\nearlier. For example, <code>code-line-numbers: \"|1|2\"</code> with\n<code>code-line-fragment-indices: \"1,2\"</code> shows line 1 at fragment\nindex 1 and line 2 at fragment index 2.\nThe first step is the code block itself and is not a fragment. Start\n<code>code-line-numbers</code> with <code>|</code> to give the first\nhighlight its own index.\nThe number of indices must equal the number of steps minus one. If it\ndoes not, or if the indices are not strictly increasing, the list is\nignored, a warning is printed, and the steps use the default order."
},
"Unique label for code listing (used in cross references)",
"Caption for code listing",
"Whether to reformat R code.",
Expand Down Expand Up @@ -18821,12 +18850,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
"_internalId": 221307,
"_internalId": 222271,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
"_internalId": 221299,
"_internalId": 222263,
"type": "enum",
"enum": [
"png",
Expand All @@ -18842,7 +18871,7 @@
"exhaustiveCompletions": true
},
"theme": {
"_internalId": 221306,
"_internalId": 222270,
"type": "anyOf",
"anyOf": [
{
Expand Down
2 changes: 2 additions & 0 deletions src/resources/filters/modules/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ local kCodeLine = "code-line"
local kCodeLines = "code-lines"
local kCellAnnotationClass = "cell-annotation"
local kCodeLineNumbers = "code-line-numbers"
local kCodeLineFragmentIndices = "code-line-fragment-indices"

local kContentVisible = "content-visible"
local kContentHidden = "content-hidden"
Expand Down Expand Up @@ -214,6 +215,7 @@ return {
kCodeLines = kCodeLines,
kCellAnnotationClass = kCellAnnotationClass,
kCodeLineNumbers = kCodeLineNumbers,
kCodeLineFragmentIndices = kCodeLineFragmentIndices,
kContentVisible = kContentVisible,
kContentHidden = kContentHidden,
kWhenFormat = kWhenFormat,
Expand Down
Loading
Loading