Skip to content

Bugfix/12167 pre: Figure label numbering for multiple figures not as subfigures #12516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 17 additions & 4 deletions src/core/jupyter/jupyter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
Loading