1- import { omd2notebookKit , ojs2notebookKit , compileKit , html2notebook } from "../src/index.ts" ;
1+ import { omd2notebookKit , ojs2notebookKit , compileNotebook , html2notebook } from "../src/index.ts" ;
22import { NotebookRuntime } from "../src/kit/runtime.ts" ;
33
44// import "@observablehq/notebook-kit/theme-air.css";
55// import "@observablehq/notebook-kit/theme-coffee.css";
66// import "@observablehq/notebook-kit/theme-cotton.css";
77// import "@observablehq/notebook-kit/theme-deep-space.css";
88// import "@observablehq/notebook-kit/theme-glacier.css";
9- // import "@observablehq/notebook-kit/theme-ink.css";
9+ import "@observablehq/notebook-kit/theme-ink.css" ;
1010// import "@observablehq/notebook-kit/theme-midnight.css";
1111// import "@observablehq/notebook-kit/theme-near-midnight.css";
1212// import "@observablehq/notebook-kit/theme-ocean-floor.css";
@@ -19,28 +19,28 @@ import { NotebookRuntime } from "../src/kit/runtime.ts";
1919
2020export async function testHtml ( target : string ) : Promise < void > {
2121
22- const element = document . getElementById ( target ) as HTMLDivElement ;
23- if ( ! element ) {
24- throw new Error ( `Element with id ${ target } not found` ) ;
25- }
26-
27- // const html = await fetch("../tests/albers-usa-projection.txt");
28- const html = await fetch ( "../tests/system-guide.txt" )
29- . then ( ( response ) => {
30- return response . text ( ) ;
31- } ) ;
32- const notebook = html2notebook ( html ) ;
33- const definitions = compileKit ( notebook ) ;
34- const runtime = new NotebookRuntime ( ) ;
35- runtime . render ( definitions , element ) ;
22+ const element = document . getElementById ( target ) as HTMLDivElement ;
23+ if ( ! element ) {
24+ throw new Error ( `Element with id ${ target } not found` ) ;
25+ }
26+
27+ // const html = await fetch("../tests/albers-usa-projection.txt");
28+ const html = await fetch ( "../tests/system-guide.txt" )
29+ . then ( ( response ) => {
30+ return response . text ( ) ;
31+ } ) ;
32+ const notebook = html2notebook ( html ) ;
33+ const definitions = compileNotebook ( notebook ) ;
34+ const runtime = new NotebookRuntime ( ) ;
35+ runtime . render ( definitions , element ) ;
3636}
3737
3838export function testOmd ( target : string ) : void {
39- const element = document . getElementById ( target ) as HTMLDivElement ;
40- if ( ! element ) {
41- throw new Error ( `Element with id ${ target } not found` ) ;
42- }
43- const omd2 = `\
39+ const element = document . getElementById ( target ) as HTMLDivElement ;
40+ if ( ! element ) {
41+ throw new Error ( `Element with id ${ target } not found` ) ;
42+ }
43+ const omd2 = `\
4444
4545## Imports (dot)
4646
@@ -331,18 +331,18 @@ value
331331
332332` ;
333333
334- const notebook = omd2notebookKit ( omd2 ) ;
335- const definitions = compileKit ( notebook ) ;
336- const runtime = new NotebookRuntime ( ) ;
337- runtime . render ( definitions , element ) ;
334+ const notebook = omd2notebookKit ( omd2 ) ;
335+ const definitions = compileKit ( notebook ) ;
336+ const runtime = new NotebookRuntime ( ) ;
337+ runtime . render ( definitions , element ) ;
338338}
339339
340340export function testOjs ( target : string ) : void {
341- const element = document . getElementById ( target ) as HTMLDivElement ;
342- if ( ! element ) {
343- throw new Error ( `Element with id ${ target } not found` ) ;
344- }
345- const ojs = `\
341+ const element = document . getElementById ( target ) as HTMLDivElement ;
342+ if ( ! element ) {
343+ throw new Error ( `Element with id ${ target } not found` ) ;
344+ }
345+ const ojs = `\
3463462 * 3 * 7
347347{
348348 let sum = 0;
@@ -357,8 +357,8 @@ md \`# lib.ojs\`;
357357mo = 38 + 40;
358358` ;
359359
360- const notebook = ojs2notebookKit ( ojs ) ;
361- const definitions = compileKit ( notebook ) ;
362- const runtime = new NotebookRuntime ( ) ;
363- runtime . render ( definitions , element ) ;
360+ const notebook = ojs2notebookKit ( ojs ) ;
361+ const definitions = compileKit ( notebook ) ;
362+ const runtime = new NotebookRuntime ( ) ;
363+ runtime . render ( definitions , element ) ;
364364}
0 commit comments