Skip to content

Commit c3b708b

Browse files
committed
jupyter: accept front matter in markdown as well as raw cells
1 parent 7e3b8de commit c3b708b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/jupyter/jupyter-fixups.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,14 @@ export function fixupFrontMatter(nb: JupyterNotebook): JupyterNotebook {
120120
// look for the first raw block that has a yaml object
121121
let partitioned: { yaml: string; markdown: string } | undefined;
122122
const frontMatterCellIndex = nb.cells.findIndex((cell) => {
123-
if (cell.cell_type === "raw") {
123+
if (cell.cell_type === "raw" || cell.cell_type === "markdown") {
124124
partitioned = partitionYamlFrontMatter(cell.source.join("")) || undefined;
125-
return !!partitioned;
125+
if (partitioned) {
126+
cell.cell_type = "raw";
127+
return true;
128+
} else {
129+
return false;
130+
}
126131
}
127132
});
128133

0 commit comments

Comments
 (0)