Skip to content

Commit 77a0cde

Browse files
committed
[perf] no cloneDeep (also bugfix if cell.source is string)
1 parent 7e30a54 commit 77a0cde

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/jupyter/jupyter.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,9 @@ export function mdFromContentCell(
963963
const contentCellEnvelope = createCellEnvelope(["cell", "markdown"], options);
964964

965965
// clone source for manipulation
966-
const source = ld.cloneDeep(cell.source) as string[];
966+
const source = typeof cell.source === "string"
967+
? [cell.source]
968+
: [...cell.source];
967969

968970
// handle user expressions (if any)
969971
if (options && source) {
@@ -1461,7 +1463,9 @@ async function mdFromCodeCell(
14611463
}
14621464
}
14631465
md.push("}\n");
1464-
let source = ld.cloneDeep(cell.source);
1466+
let source = typeof cell.source === "string"
1467+
? [cell.source]
1468+
: [...cell.source];
14651469
if (fenced) {
14661470
const optionsSource = cell.optionsSource.filter((line) =>
14671471
line.search(/\|\s+echo:\s+fenced\s*$/) === -1

0 commit comments

Comments
 (0)