-
Notifications
You must be signed in to change notification settings - Fork 433
Expand file tree
/
Copy pathindex.d.ts
More file actions
1696 lines (1693 loc) · 46.5 KB
/
index.d.ts
File metadata and controls
1696 lines (1693 loc) · 46.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Generated by dts-bundle-generator v9.5.1
/**
* Core text manipulation types for Quarto
*/
/**
* Represents a range within a string
*/
interface Range$1 {
start: number;
end: number;
}
/**
* A string with source mapping information
*/
export interface MappedString {
/**
* The text content
*/
readonly value: string;
/**
* Optional filename where the content originated
*/
readonly fileName?: string;
/**
* Maps positions in this string back to positions in the original source
* @param index Position in the current string
* @param closest Whether to find the closest mapping if exact is not available
*/
readonly map: (index: number, closest?: boolean) => StringMapResult;
}
/**
* Result of mapping a position in a mapped string
*/
export type StringMapResult = {
/**
* Position in the original source
*/
index: number;
/**
* Reference to the original mapped string
*/
originalString: MappedString;
} | undefined;
/**
* String that may be mapped or unmapped
*/
export type EitherString = string | MappedString;
/**
* Basic metadata types used across Quarto
*/
/**
* Generic metadata key-value store
*/
export type Metadata = {
[key: string]: unknown;
};
/**
* Valid format identifier keys
*/
export type FormatIdentifierKey = "base-format" | "target-format" | "display-name" | "extension-name";
/**
* Format identifier information
*/
export type FormatIdentifier = {
[K in FormatIdentifierKey]?: string;
};
/**
* Format language/localization strings
*/
export interface FormatLanguage {
[key: string]: string | undefined;
}
/**
* Complete Format type for engine interfaces
*/
export interface Format {
/**
* Format identifier
*/
identifier: FormatIdentifier;
/**
* Format language/localization strings
*/
language: FormatLanguage;
/**
* Document metadata
*/
metadata: Metadata;
/**
* Format rendering options
*/
render: Record<string, unknown>;
/**
* Format execution options
*/
execute: Record<string, unknown>;
/**
* Format pandoc options
*/
pandoc: {
to?: string;
[key: string]: unknown;
};
}
/**
* External engine interfaces for Quarto
*/
/**
* Represents an external engine specified in a project
*/
export interface ExternalEngine {
/**
* Path to the engine implementation
*/
path: string;
}
/**
* Information about a file being processed
*/
export interface FileInformation {
/**
* Full markdown content after expanding includes
*/
fullMarkdown?: MappedString;
/**
* Map of file inclusions
*/
includeMap?: {
source: string;
target: string;
}[];
/**
* The launched execution engine for this file
*/
engine?: ExecutionEngineInstance;
/**
* The execution target for this file
*/
target?: ExecutionTarget;
/**
* Document metadata
*/
metadata?: Metadata;
}
/**
* A restricted version of ProjectContext that only exposes
* functionality needed by execution engines.
*/
export interface EngineProjectContext {
/**
* Base directory of the project
*/
dir: string;
/**
* Flag indicating if project consists of a single file
*/
isSingleFile: boolean;
/**
* Config object containing project configuration
* Used primarily for config?.engines access
*/
config?: {
engines?: (string | ExternalEngine)[];
project?: {
outputDir?: string;
};
};
/**
* For file information cache management
* Used for the transient notebook tracking in Jupyter
*/
fileInformationCache: Map<string, FileInformation>;
/**
* Get the output directory for the project
*
* @returns Path to output directory
*/
getOutputDirectory: () => string;
/**
* Resolves full markdown content for a file, including expanding includes
*
* @param engine - The execution engine
* @param file - Path to the file
* @param markdown - Optional existing markdown content
* @param force - Whether to force re-resolution even if cached
* @returns Promise resolving to mapped markdown string
*/
resolveFullMarkdownForFile: (engine: ExecutionEngineInstance | undefined, file: string, markdown?: MappedString, force?: boolean) => Promise<MappedString>;
}
/**
* Minimal type definitions for CLI commands
*/
export interface Command {
command(name: string, description?: string): Command;
description(description: string): Command;
action(fn: (...args: any[]) => void | Promise<void>): Command;
arguments(args: string): Command;
option(flags: string, description: string, options?: any): Command;
}
/**
* Cell type from breaking Quarto markdown
*/
export interface QuartoMdCell {
id?: string;
cell_type: {
language: string;
} | "markdown" | "raw";
options?: Record<string, unknown>;
source: MappedString;
sourceVerbatim: MappedString;
sourceWithYaml?: MappedString;
sourceOffset: number;
sourceStartLine: number;
cellStartLine: number;
}
/**
* Result from breaking Quarto markdown
*/
export interface QuartoMdChunks {
cells: QuartoMdCell[];
}
/**
* A partitioned markdown document
*/
export interface PartitionedMarkdown {
/** YAML frontmatter as parsed metadata */
yaml?: Metadata;
/** Text of the first heading */
headingText?: string;
/** Attributes of the first heading */
headingAttr?: {
id: string;
classes: string[];
keyvalue: Array<[
string,
string
]>;
};
/** Whether the document contains references */
containsRefs: boolean;
/** Complete markdown content */
markdown: string;
/** Markdown without YAML frontmatter */
srcMarkdownNoYaml: string;
}
/**
* Pandoc types for Quarto
*/
/**
* Valid Pandoc include locations
*/
export type PandocIncludeLocation = "include-in-header" | "include-before-body" | "include-after-body";
/**
* Pandoc includes for headers, body, etc.
* Mapped type that allows any of the valid include locations
*/
export type PandocIncludes = {
[K in PandocIncludeLocation]?: string[];
};
/**
* Options for execution
*/
export interface ExecuteOptions {
/** The execution target */
target: ExecutionTarget;
/** Format to render to */
format: Format;
/** Directory for resources */
resourceDir: string;
/** Directory for temporary files */
tempDir: string;
/** Whether to include dependencies */
dependencies: boolean;
/** Project directory if applicable */
projectDir?: string;
/** Library directory */
libDir?: string;
/** Current working directory */
cwd: string;
/** Parameters passed to document */
params?: {
[key: string]: unknown;
};
/** Whether to suppress output */
quiet?: boolean;
/** Whether execution is for preview server */
previewServer?: boolean;
/** List of languages handled by cell language handlers */
handledLanguages: string[];
/** Project context */
project: EngineProjectContext;
}
/**
* Result of execution
*/
export interface ExecuteResult {
/** Resulting markdown content */
markdown: string;
/** Supporting files */
supporting: string[];
/** Filter scripts */
filters: string[];
/** Updated metadata */
metadata?: Metadata;
/** Pandoc options */
pandoc?: Record<string, unknown>;
/** Pandoc includes */
includes?: PandocIncludes;
/** Engine name */
engine?: string;
/** Engine-specific dependencies */
engineDependencies?: Record<string, Array<unknown>>;
/** Content to preserve during processing */
preserve?: Record<string, string>;
/** Whether post-processing is required */
postProcess?: boolean;
/** Additional resource files */
resourceFiles?: string[];
}
/**
* Options for retrieving dependencies
*/
export interface DependenciesOptions {
/** The execution target */
target: ExecutionTarget;
/** Format to render to */
format: Format;
/** Output file path */
output: string;
/** Directory for resources */
resourceDir: string;
/** Directory for temporary files */
tempDir: string;
/** Project directory if applicable */
projectDir?: string;
/** Library directory */
libDir?: string;
/** Dependencies to include */
dependencies?: Array<unknown>;
/** Whether to suppress output */
quiet?: boolean;
}
/**
* Result of retrieving dependencies
*/
export interface DependenciesResult {
/** Pandoc includes */
includes: PandocIncludes;
}
/**
* Options for post-processing
*/
export interface PostProcessOptions {
/** The execution engine */
engine: ExecutionEngineInstance;
/** The execution target */
target: ExecutionTarget;
/** Format to render to */
format: Format;
/** Output file path */
output: string;
/** Directory for temporary files */
tempDir: string;
/** Project directory if applicable */
projectDir?: string;
/** Content to preserve during processing */
preserve?: Record<string, string>;
/** Whether to suppress output */
quiet?: boolean;
}
/**
* Options for running the engine
*/
export interface RunOptions {
/** Input file path */
input: string;
/** Whether to render */
render: boolean;
/** Whether to open in browser */
browser: boolean;
/** Directory for temporary files */
tempDir: string;
/** Whether to reload */
reload?: boolean;
/** Target format */
format?: string;
/** Project directory if applicable */
projectDir?: string;
/** Port for server */
port?: number;
/** Host for server */
host?: string;
/** Whether to suppress output */
quiet?: boolean;
/** Callback when ready */
onReady?: () => Promise<void>;
}
/**
* Jupyter notebook kernelspec
*/
export interface JupyterKernelspec {
name: string;
language: string;
display_name: string;
path?: string;
}
/**
* Jupyter language info
*/
export type JupyterLanguageInfo = {
name: string;
codemirror_mode?: string | Record<string, unknown>;
file_extension?: string;
mimetype?: string;
pygments_lexer?: string;
};
/**
* Jupyter notebook cell metadata
*/
export interface JupyterCellMetadata {
[key: string]: unknown;
}
/**
* Jupyter notebook output
*/
export interface JupyterOutput {
output_type: string;
metadata?: {
[mimetype: string]: Record<string, unknown>;
};
execution_count?: number;
[key: string]: unknown;
}
/**
* Jupyter output stream
*/
export interface JupyterOutputStream extends JupyterOutput {
name: "stdout" | "stderr";
text: string[] | string;
}
/**
* Jupyter output display data
*/
export interface JupyterOutputDisplayData extends JupyterOutput {
data: {
[mimeType: string]: unknown;
};
metadata: {
[mimeType: string]: Record<string, unknown>;
};
noCaption?: boolean;
}
/**
* Jupyter output figure options
*/
export interface JupyterOutputFigureOptions {
[key: string]: unknown;
}
/**
* Jupyter cell options
*/
export interface JupyterCellOptions extends JupyterOutputFigureOptions {
[key: string]: unknown;
}
/**
* Jupyter cell with options
*/
export interface JupyterCellWithOptions extends JupyterCell {
id: string;
options: JupyterCellOptions;
optionsSource: string[];
}
/**
* Jupyter notebook cell
*/
export interface JupyterCell {
cell_type: "markdown" | "code" | "raw";
metadata: JupyterCellMetadata;
source: string | string[];
id?: string;
execution_count?: number | null;
outputs?: JupyterOutput[];
attachments?: {
[filename: string]: {
[mimetype: string]: string | string[];
};
};
}
/**
* Jupyter user expression
*/
export interface JupyterUserExpression {
expression: string;
result: JupyterUserExpressionResult;
}
/**
* Jupyter user expression result
*/
export interface JupyterUserExpressionResult extends JupyterCellOutputData {
metadata: Metadata;
status: string;
}
/**
* Jupyter cell output data
*/
export interface JupyterCellOutputData {
data: {
[mimeType: string]: unknown;
};
}
/**
* Jupyter cell slideshow
*/
export interface JupyterCellSlideshow {
[key: string]: string;
}
/**
* Jupyter notebook structure
*/
export interface JupyterNotebook {
cells: JupyterCell[];
metadata: {
kernelspec: JupyterKernelspec;
widgets?: Record<string, unknown>;
language_info?: JupyterLanguageInfo;
[key: string]: unknown;
};
nbformat: number;
nbformat_minor: number;
}
/**
* Asset paths for Jupyter notebook output
*/
export interface JupyterNotebookAssetPaths {
base_dir: string;
files_dir: string;
figures_dir: string;
supporting_dir: string;
}
/**
* Format execution options
*/
export interface FormatExecute {
[key: string]: unknown;
}
/**
* Format render options
*/
export interface FormatRender {
[key: string]: unknown;
}
/**
* Format pandoc options
*/
export interface FormatPandoc {
to?: string;
[key: string]: unknown;
}
/**
* Jupyter widget state information
*/
export interface JupyterWidgetsState {
state: Record<string, unknown>;
version_major: number;
version_minor: number;
}
/**
* Widget dependencies from Jupyter notebook
*/
export interface JupyterWidgetDependencies {
jsWidgets: boolean;
jupyterWidgets: boolean;
htmlLibraries: string[];
widgetsState?: JupyterWidgetsState;
}
/**
* Jupyter capabilities
*/
export interface JupyterCapabilities {
versionMajor: number;
versionMinor: number;
versionPatch: number;
versionStr: string;
execPrefix: string;
executable: string;
conda: boolean;
pyLauncher: boolean;
jupyter_core: string | null;
nbformat: string | null;
nbclient: string | null;
ipykernel: string | null;
shiny: string | null;
}
/**
* Extended Jupyter capabilities
*/
export interface JupyterCapabilitiesEx extends JupyterCapabilities {
kernels?: JupyterKernelspec[];
venv?: boolean;
}
/**
* Cell output with markdown
*/
export interface JupyterCellOutput {
id: string;
markdown: string;
metadata: Record<string, unknown>;
options: Record<string, unknown>;
}
/**
* Options for converting Jupyter notebook to markdown
*/
export interface JupyterToMarkdownOptions {
executeOptions: ExecuteOptions;
language: string;
assets: JupyterNotebookAssetPaths;
execute: FormatExecute;
keepHidden?: boolean;
toHtml: boolean;
toLatex: boolean;
toMarkdown: boolean;
toIpynb: boolean;
toPresentation: boolean;
figFormat?: string;
figDpi?: number;
figPos?: string;
preserveCellMetadata?: boolean;
preserveCodeCellYaml?: boolean;
outputPrefix?: string;
fixups?: string | unknown[];
}
/**
* Options for converting Quarto markdown to Jupyter notebook
*/
export interface QuartoMdToJupyterOptions {
title?: string;
format?: Format;
}
/**
* Result of converting Jupyter notebook to markdown
*/
export interface JupyterToMarkdownResult {
cellOutputs: JupyterCellOutput[];
notebookOutputs?: {
prefix?: string;
suffix?: string;
};
dependencies?: JupyterWidgetDependencies;
htmlPreserve?: Record<string, string>;
pandoc?: Record<string, unknown>;
}
/**
* System and process types for Quarto
*/
/**
* Process execution result
*/
export interface ProcessResult {
success: boolean;
code: number;
stdout?: string;
stderr?: string;
}
/**
* Process execution options
*/
export type ExecProcessOptions = {
cmd: string;
args?: string[];
cwd?: string;
env?: Record<string, string>;
stdout?: "piped" | "inherit" | "null";
stderr?: "piped" | "inherit" | "null";
stdin?: "piped" | "inherit" | "null";
};
/**
* Preview server interface
*/
export interface PreviewServer {
/** Start the server and return the URL to browse to */
start: () => Promise<string | undefined>;
/** Run the server (blocking) */
serve: () => Promise<void>;
/** Stop the server */
stop: () => Promise<void>;
}
/**
* Temporary context for managing temporary files and directories
*/
export interface TempContext {
/** Base directory for temporary files */
baseDir: string;
/** Create a temporary file from string content and return its path */
createFileFromString: (content: string, options?: {
suffix?: string;
prefix?: string;
dir?: string;
}) => string;
/** Create a temporary file and return its path */
createFile: (options?: {
suffix?: string;
prefix?: string;
dir?: string;
}) => string;
/** Create a temporary directory and return its path */
createDir: (options?: {
suffix?: string;
prefix?: string;
dir?: string;
}) => string;
/** Clean up all temporary resources */
cleanup: () => void;
/** Register a cleanup handler */
onCleanup: (handler: VoidFunction) => void;
}
/**
* Console and UI types for Quarto
*/
/**
* Options for displaying a spinner in the console
*/
export interface SpinnerOptions {
/** Message to display with the spinner (or function that returns message) */
message: string | (() => string);
/** Message to display when done, or false to hide, or true to keep original message */
doneMessage?: string | boolean;
}
/**
* Options for log messages (info, warning, error)
*/
export interface LogMessageOptions {
/** Whether to add a trailing newline (default: true) */
newline?: boolean;
/** Apply bold formatting */
bold?: boolean;
/** Apply dim/gray formatting */
dim?: boolean;
/** Number of spaces to indent each line */
indent?: number;
/** Custom format function applied to each line */
format?: (line: string) => string;
/** Enable color formatting (default: true) */
colorize?: boolean;
/** Remove ANSI escape codes from output */
stripAnsiCode?: boolean;
}
/**
* Render services available during check operations
* Simplified version containing only what check operations need
*/
export interface CheckRenderServices {
/** Temporary file management */
temp: TempContext;
/** Placeholder for extension context (not used by check) */
extension?: unknown;
/** Placeholder for notebook context (not used by check) */
notebook?: unknown;
}
/**
* Render services with cleanup capability
*/
export interface CheckRenderServiceWithLifetime extends CheckRenderServices {
/** Cleanup function to release resources */
cleanup: () => void;
/** Optional lifetime management */
lifetime?: unknown;
}
/**
* Configuration for check command operations
* Used by engines implementing checkInstallation()
*/
export interface CheckConfiguration {
/** Whether to run strict checks */
strict: boolean;
/** Target being checked (e.g., "jupyter", "knitr", "all") */
target: string;
/** Optional output file path for JSON results */
output: string | undefined;
/** Render services (primarily for temp file management) */
services: CheckRenderServiceWithLifetime;
/** JSON result object (undefined if not outputting JSON) */
jsonResult: Record<string, unknown> | undefined;
}
/**
* Options for test-rendering a document during check operations
*/
export interface CheckRenderOptions {
/** Markdown content to render */
content: string;
/** Language identifier (e.g., "python", "r", "julia") */
language: string;
/** Render services for temp file management */
services: CheckRenderServiceWithLifetime;
}
/**
* Result of a check render operation
*/
export interface CheckRenderResult {
/** Whether the render succeeded */
success: boolean;
/** Error if render failed */
error?: Error;
}
/**
* Global Quarto API interface
*/
export interface QuartoAPI {
/**
* Markdown processing utilities using regex patterns
*/
markdownRegex: {
/**
* Extract and parse YAML frontmatter from markdown
*
* @param markdown - Markdown content with YAML frontmatter
* @returns Parsed metadata object
*/
extractYaml: (markdown: string) => Metadata;
/**
* Split markdown into components (YAML, heading, content)
*
* @param markdown - Markdown content
* @returns Partitioned markdown with yaml, heading, and content sections
*/
partition: (markdown: string) => PartitionedMarkdown;
/**
* Extract programming languages from code blocks
*
* @param markdown - Markdown content to analyze
* @returns Set of language identifiers found in fenced code blocks
*/
getLanguages: (markdown: string) => Set<string>;
/**
* Extract programming languages and their first class from code blocks
*
* @param markdown - Markdown content to analyze
* @returns Map of language identifiers to their first class (or undefined)
*/
getLanguagesWithClasses: (markdown: string) => Map<string, string | undefined>;
/**
* Break Quarto markdown into cells
*
* @param src - Markdown string or MappedString
* @param validate - Whether to validate cells (default: false)
* @param lenient - Whether to use lenient parsing (default: false)
* @param startCodeCellRegex - Optional custom regex for detecting code cell starts.
* Must have capture group 1 for backticks and group 2 for language.
* Default matches `{language}` syntax.
* @returns Promise resolving to chunks with cells
*/
breakQuartoMd: (src: string | MappedString, validate?: boolean, lenient?: boolean, startCodeCellRegex?: RegExp) => Promise<QuartoMdChunks>;
};
/**
* MappedString utilities for source location tracking
*/
mappedString: {
/**
* Create a mapped string from plain text
*
* @param text - Text content
* @param fileName - Optional filename for source tracking
* @returns MappedString with identity mapping
*/
fromString: (text: string, fileName?: string) => MappedString;
/**
* Read a file and create a mapped string
*
* @param path - Path to the file to read
* @returns MappedString with file content and source information
*/
fromFile: (path: string) => MappedString;
/**
* Normalize newlines while preserving source mapping
*
* @param markdown - MappedString to normalize
* @returns MappedString with \r\n converted to \n
*/
normalizeNewlines: (markdown: MappedString) => MappedString;
/**
* Split a MappedString into lines
*
* @param str - MappedString to split
* @param keepNewLines - Whether to keep newline characters (default: false)
* @returns Array of MappedStrings, one per line
*/
splitLines: (str: MappedString, keepNewLines?: boolean) => MappedString[];
/**
* Convert character offset to line/column coordinates
*
* @param str - MappedString to query
* @param offset - Character offset to convert
* @returns Line and column numbers (1-indexed)
*/
indexToLineCol: (str: MappedString, offset: number) => {
line: number;
column: number;
};
};
/**
* Jupyter notebook integration utilities
*/
jupyter: {
/**
* Check if a file is a Jupyter notebook
*
* @param file - File path to check
* @returns True if file is a Jupyter notebook (.ipynb)
*/
isJupyterNotebook: (file: string) => boolean;
/**
* Check if a file is a Jupyter percent script
*
* @param file - File path to check
* @param extensions - Optional array of extensions to check (default: ['.py', '.jl', '.r'])
* @returns True if file is a Jupyter percent script
*/
isPercentScript: (file: string, extensions?: string[]) => boolean;
/**
* List of Jupyter notebook file extensions
*/
notebookExtensions: string[];
/**
* Extract kernelspec from markdown content
*
* @param markdown - Markdown content with YAML frontmatter
* @returns Extracted kernelspec or undefined if not found
*/
kernelspecFromMarkdown: (markdown: string) => JupyterKernelspec | undefined;
/**
* Find a Jupyter kernelspec that supports a given language
*
* @param language - Language to find kernel for (e.g., "python", "julia", "r")
* @returns Promise resolving to matching kernelspec or undefined if not found
*/
kernelspecForLanguage: (language: string) => Promise<JupyterKernelspec | undefined>;
/**
* Convert JSON string to Jupyter notebook
*
* @param nbJson - JSON string containing notebook data
* @returns Parsed Jupyter notebook object
*/
fromJSON: (nbJson: string) => JupyterNotebook;
/**
* Convert a Jupyter notebook to markdown
*
* @param nb - Jupyter notebook to convert
* @param options - Conversion options
* @returns Converted markdown with cell outputs and dependencies
*/
toMarkdown: (nb: JupyterNotebook, options: JupyterToMarkdownOptions) => Promise<JupyterToMarkdownResult>;
/**
* Convert Jupyter notebook file to markdown
*
* @param file - Path to notebook file
* @param format - Optional format to use for conversion
* @returns Markdown content extracted from notebook
*/
markdownFromNotebookFile: (file: string, format?: Format) => string;
/**
* Convert Jupyter notebook JSON to markdown
*
* @param nbJson - Notebook JSON string
* @returns Markdown content extracted from notebook
*/
markdownFromNotebookJSON: (nbJson: string) => string;
/**
* Convert a Jupyter percent script to markdown
*
* @param file - Path to the percent script file
* @returns Converted markdown content
*/
percentScriptToMarkdown: (file: string) => string;
/**
* Convert Quarto markdown to Jupyter notebook
*
* @param markdown - Markdown content with YAML frontmatter
* @param includeIds - Whether to include cell IDs
* @param project - Optional project context for config merging
* @returns Promise resolving to Jupyter notebook generated from markdown
*/
quartoMdToJupyter: (markdown: string, includeIds: boolean, project?: EngineProjectContext) => Promise<JupyterNotebook>;
/**
* Apply filters to a Jupyter notebook
*
* @param nb - Jupyter notebook to filter
* @param filters - Array of filter strings to apply
* @returns Filtered notebook
*/
notebookFiltered: (nb: JupyterNotebook, filters: string[]) => JupyterNotebook;
/**
* Create asset paths for Jupyter notebook output
*
* @param input - Input file path
* @param to - Output format (optional)
* @returns Asset paths for files, figures, and supporting directories
*/
assets: (input: string, to?: string) => JupyterNotebookAssetPaths;
/**
* Generate Pandoc includes for Jupyter widget dependencies