Skip to content

Commit 407689a

Browse files
authored
Merge pull request #1915 from kp992/myst-to-ipynb-2
Complete ipynb export support
2 parents 7c1aa47 + 1975f85 commit 407689a

File tree

4 files changed

+543
-281
lines changed

4 files changed

+543
-281
lines changed

packages/myst-cli/src/build/build.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('get export formats', () => {
3636
ExportFormats.tex,
3737
ExportFormats.xml,
3838
ExportFormats.md,
39+
ExportFormats.ipynb,
3940
ExportFormats.meca,
4041
ExportFormats.cff,
4142
]);

packages/myst-to-ipynb/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ export function writeIpynb(file: VFile, node: Root, frontmatter?: PageFrontmatte
2424
source: sourceToStringList(code.value),
2525
};
2626
}
27-
const md = writeMd(file, { type: 'root', children: block.children as any }).result as string;
27+
const md = writeMd(file, { type: 'root', children: [block] }).result as string;
2828
return {
2929
cell_type: 'markdown',
3030
metadata: {},
3131
source: sourceToStringList(md),
3232
};
3333
});
34+
3435
const ipynb = {
3536
cells,
3637
metadata: {
@@ -41,6 +42,7 @@ export function writeIpynb(file: VFile, node: Root, frontmatter?: PageFrontmatte
4142
nbformat: 4,
4243
nbformat_minor: 2,
4344
};
45+
4446
file.result = JSON.stringify(ipynb, null, 2);
4547
return file;
4648
}

0 commit comments

Comments
 (0)