@@ -16,7 +16,6 @@ import {
1616 jupyterNotebookToMarkdown ,
1717 markdownToJupyterNotebook ,
1818} from "./jupyter.ts" ;
19- import { isObservableUrl , observableNotebookToMarkdown } from "./observable.ts" ;
2019import { initYamlIntelligenceResourcesFromFilesystem } from "../../core/schema/utils.ts" ;
2120
2221const kNotebookFormat = "notebook" ;
@@ -52,40 +51,32 @@ export const convertCommand = new Command()
5251 . action ( async ( options : any , input : string ) => {
5352 await initYamlIntelligenceResourcesFromFilesystem ( ) ;
5453
55- // separate codepath for observable urls
56- if ( isObservableUrl ( input ) ) {
57- await observableNotebookToMarkdown (
58- input ,
59- options . output as string | undefined ,
60- ) ;
61- } else {
62- if ( ! await exists ( input ) ) {
63- throw new Error ( `File not found: '${ input } '` ) ;
64- }
54+ if ( ! await exists ( input ) ) {
55+ throw new Error ( `File not found: '${ input } '` ) ;
56+ }
6557
66- // determine source format
67- const srcFormat = isJupyterNotebook ( input )
68- ? kNotebookFormat
69- : kMarkdownFormat ;
58+ // determine source format
59+ const srcFormat = isJupyterNotebook ( input )
60+ ? kNotebookFormat
61+ : kMarkdownFormat ;
7062
71- // are we converting ids?
72- const withIds = options . withIds === undefined ? false : ! ! options . withIds ;
63+ // are we converting ids?
64+ const withIds = options . withIds === undefined ? false : ! ! options . withIds ;
7365
74- // perform conversion
75- const converted = srcFormat === kNotebookFormat
76- ? await jupyterNotebookToMarkdown ( input , withIds )
77- : await markdownToJupyterNotebook ( input , withIds ) ;
66+ // perform conversion
67+ const converted = srcFormat === kNotebookFormat
68+ ? await jupyterNotebookToMarkdown ( input , withIds )
69+ : await markdownToJupyterNotebook ( input , withIds ) ;
7870
79- // write output
80- const [ dir , stem ] = dirAndStem ( input ) ;
81- let output = options . output ;
82- if ( ! output ) {
83- output = join (
84- dir ,
85- stem + ( srcFormat === kMarkdownFormat ? ".ipynb" : ".qmd" ) ,
86- ) ;
87- }
88- Deno . writeTextFileSync ( output , converted ) ;
89- info ( `Converted to ${ output } ` ) ;
71+ // write output
72+ const [ dir , stem ] = dirAndStem ( input ) ;
73+ let output = options . output ;
74+ if ( ! output ) {
75+ output = join (
76+ dir ,
77+ stem + ( srcFormat === kMarkdownFormat ? ".ipynb" : ".qmd" ) ,
78+ ) ;
9079 }
80+ Deno . writeTextFileSync ( output , converted ) ;
81+ info ( `Converted to ${ output } ` ) ;
9182 } ) ;
0 commit comments