Skip to content

Commit 3ec1d8e

Browse files
committed
only target ipynb
1 parent cb656f9 commit 3ec1d8e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core/jupyter/jupyter.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ import { convertToHtmlSpans, hasAnsiEscapeCodes } from "../ansi-colors.ts";
150150
import { ProjectContext } from "../../project/types.ts";
151151
import { mergeConfigs } from "../config.ts";
152152
import { encode as encodeBase64 } from "encoding/base64.ts";
153+
import { isIpynbOutput } from "../../config/format.ts";
153154

154155
export const kQuartoMimeType = "quarto_mimetype";
155156
export const kQuartoOutputOrder = "quarto_order";
@@ -1096,6 +1097,14 @@ async function mdFromCodeCell(
10961097
// write div enclosure
10971098
const divMd: string[] = [`::: {`];
10981099

1100+
// If we're targeting ipynb output, include the id in the
1101+
// markdown. This will cause the id to be included in the
1102+
// rendered notebook. Note that elsewhere we forard the
1103+
// label to the id, so that can appear as the cell id.
1104+
if (isIpynbOutput(options.executeOptions.format.pandoc) && cell.id) {
1105+
divMd.push(`#${cell.id} `);
1106+
}
1107+
10991108
// metadata to exclude from cell div attributes
11001109
const kCellOptionsFilter = kJupyterCellInternalOptionKeys.concat(
11011110
kJupyterCellStandardMetadataKeys,

0 commit comments

Comments
 (0)