Skip to content

Commit e68ddee

Browse files
committed
add --format=json option.
1 parent 2bb8928 commit e68ddee

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bin/observable-prerender

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const formatOptions = new Set([
1717
"svg",
1818
"text",
1919
"txt",
20+
"json",
2021
]);
2122

2223
program
@@ -168,6 +169,11 @@ program
168169
if (format === "html") return notebook.html(cell, path);
169170
if (format === "text" || format === "txt")
170171
return writeFileSync(path, await notebook.value(cell));
172+
if (format === "json")
173+
return writeFileSync(
174+
path,
175+
JSON.stringify(await notebook.value(cell))
176+
);
171177
return notebook.screenshot(cell, path, { type: format });
172178
})
173179
);

0 commit comments

Comments
 (0)