diff --git a/news/changelog-1.7.md b/news/changelog-1.7.md index 2071de9389..056122e91b 100644 --- a/news/changelog-1.7.md +++ b/news/changelog-1.7.md @@ -173,6 +173,7 @@ All changes included in 1.7: - ([#11951](https://github.com/quarto-dev/quarto-cli/issues/11951)): Raw LaTeX table without `tbl-` prefix label for using Quarto crossref are now correctly passed through unmodified. - ([#11967](https://github.com/quarto-dev/quarto-cli/issues/11967)): Produce a better error message when YAML metadata with `!expr` tags are used outside of `knitr` code cells. - ([#12117](https://github.com/quarto-dev/quarto-cli/issues/12117)): Color output to stdout and stderr is now correctly rendered for `html` format in the Jupyter and Julia engines. +- ([#12167](https://github.com/quarto-dev/quarto-cli/issues/12167)): Figure numbering for multiple top-level figures and not as Sub-Figures. - ([#12264](https://github.com/quarto-dev/quarto-cli/issues/12264)): Upgrade `dart-sass` to 1.85.1. - ([#12238](https://github.com/quarto-dev/quarto-cli/issues/12238)): Do not truncate very long console errors (e.g. in Jupyter Notebook with backtrace). - ([#12338](https://github.com/quarto-dev/quarto-cli/issues/12338)): Add an additional workaround for the SCSS parser used in color variable extraction. diff --git a/src/core/jupyter/jupyter.ts b/src/core/jupyter/jupyter.ts index a3e5923f79..3fc1a4a20a 100644 --- a/src/core/jupyter/jupyter.ts +++ b/src/core/jupyter/jupyter.ts @@ -8,6 +8,7 @@ import { ensureDirSync, walkSync } from "../../deno_ral/fs.ts"; import { dirname, extname, join, relative } from "../../deno_ral/path.ts"; +import { warning } from "../../deno_ral/log.ts"; import * as colors from "fmt/colors"; import { decodeBase64 as base64decode } from "encoding/base64"; import { stringify } from "../yaml.ts"; @@ -1554,10 +1555,22 @@ async function mdFromCodeCell( for (const { index, output } of sortedOutputs) { // compute output label - const outputLabel = label && labelCellContainer && isDisplayData(output) - ? (label + "-" + nextOutputSuffix++) - : label; - + let outputLabel_tmp = label; + if (label && + ( + labelCellContainer || + (Array.isArray(sortedOutputs) && (sortedOutputs.length > 1)) + ) && + isDisplayData(output)) { + outputLabel_tmp = label + "-" + nextOutputSuffix++; + // If the user specifies a top-level array for images but also labels give a warning. + if (labelCellContainer === false && + (Array.isArray(sortedOutputs) == true && (sortedOutputs.length > 1)) + ) { + warning("Warning: using multiple top-level figures with labels might result in unwanted behaviour: " + label) + } + } + const outputLabel = outputLabel_tmp // If this output has been marked to not be displayed // just continue if (output.metadata?.[kQuartoOutputDisplay] === false) {