markdownfly 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +289 -0
- package/dist/cli.js +2756 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +217 -0
- package/dist/index.js +2653 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration type definitions
|
|
3
|
+
*/
|
|
4
|
+
interface MarkdownFlyConfig {
|
|
5
|
+
theme: string;
|
|
6
|
+
author?: string;
|
|
7
|
+
date?: string;
|
|
8
|
+
footer?: string;
|
|
9
|
+
/** Base directory for relative image paths (defaults to the .md file's dir) */
|
|
10
|
+
resourceDir?: string;
|
|
11
|
+
/** Default layout for slides without @(layout=...) (auto-detection used when unset) */
|
|
12
|
+
layout?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Slide IR (Intermediate Representation)
|
|
17
|
+
* Core data structures for the MarkdownFly pipeline
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Available slide layouts */
|
|
21
|
+
type SlideLayout = 'title' | 'section' | 'content' | 'two-column' | 'code' | 'quote' | 'blank' | 'closing';
|
|
22
|
+
/** A layout marker inside a slide: starts a new row (===) or column (<->) */
|
|
23
|
+
interface BreakElement {
|
|
24
|
+
type: 'break';
|
|
25
|
+
direction: 'row' | 'col';
|
|
26
|
+
}
|
|
27
|
+
/** Callout box (> [!NOTE]/[!TIP]/[...]) */
|
|
28
|
+
interface CalloutElement {
|
|
29
|
+
type: 'callout';
|
|
30
|
+
variant: string;
|
|
31
|
+
/** Custom title from "> [!WARNING] my title"; defaults to variant name */
|
|
32
|
+
title?: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}
|
|
35
|
+
/** Slide-level directives parsed from @(key=value, ...) */
|
|
36
|
+
interface SlideDirectives {
|
|
37
|
+
layout?: string;
|
|
38
|
+
notes?: string;
|
|
39
|
+
chart?: string;
|
|
40
|
+
highlight?: string;
|
|
41
|
+
background?: string;
|
|
42
|
+
steps?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface TextElement {
|
|
45
|
+
type: 'text';
|
|
46
|
+
content: string;
|
|
47
|
+
bold?: boolean;
|
|
48
|
+
italic?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface HeadingElement {
|
|
51
|
+
type: 'heading';
|
|
52
|
+
content: string;
|
|
53
|
+
level: number;
|
|
54
|
+
}
|
|
55
|
+
interface ListElement {
|
|
56
|
+
type: 'list';
|
|
57
|
+
items: string[];
|
|
58
|
+
ordered: boolean;
|
|
59
|
+
/** Parallel to items; present only for task lists (- [x] / - [ ]) */
|
|
60
|
+
checked?: boolean[];
|
|
61
|
+
}
|
|
62
|
+
interface CodeElement {
|
|
63
|
+
type: 'code';
|
|
64
|
+
content: string;
|
|
65
|
+
language?: string;
|
|
66
|
+
/** 1-based line numbers to highlight (from @(highlight=...)) */
|
|
67
|
+
highlightLines?: number[];
|
|
68
|
+
}
|
|
69
|
+
type ImageAlign = 'left' | 'center' | 'right';
|
|
70
|
+
interface ImageElement {
|
|
71
|
+
type: 'image';
|
|
72
|
+
src: string;
|
|
73
|
+
alt?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Optional size from `{w=6in}` — normalized to inches
|
|
76
|
+
* (e.g. '6in') or percentage of the column (e.g. '60%')
|
|
77
|
+
*/
|
|
78
|
+
width?: string;
|
|
79
|
+
height?: string;
|
|
80
|
+
/** Horizontal alignment inside the column (default 'center') */
|
|
81
|
+
align?: ImageAlign;
|
|
82
|
+
}
|
|
83
|
+
interface TableElement {
|
|
84
|
+
type: 'table';
|
|
85
|
+
headers: string[];
|
|
86
|
+
rows: string[][];
|
|
87
|
+
}
|
|
88
|
+
interface BlockquoteElement {
|
|
89
|
+
type: 'blockquote';
|
|
90
|
+
content: string;
|
|
91
|
+
}
|
|
92
|
+
interface DiagramElement {
|
|
93
|
+
type: 'diagram';
|
|
94
|
+
diagramType: string;
|
|
95
|
+
content: string;
|
|
96
|
+
}
|
|
97
|
+
type SlideElement = TextElement | HeadingElement | ListElement | CodeElement | ImageElement | TableElement | BlockquoteElement | DiagramElement | BreakElement | CalloutElement;
|
|
98
|
+
/** A single slide in the presentation */
|
|
99
|
+
interface SlideNode {
|
|
100
|
+
layout: SlideLayout;
|
|
101
|
+
title?: string;
|
|
102
|
+
subtitle?: string;
|
|
103
|
+
elements: SlideElement[];
|
|
104
|
+
notes?: string;
|
|
105
|
+
directives?: SlideDirectives;
|
|
106
|
+
metadata?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
/** The complete presentation */
|
|
109
|
+
interface Presentation {
|
|
110
|
+
config: MarkdownFlyConfig;
|
|
111
|
+
slides: SlideNode[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Markdown Parser
|
|
116
|
+
* Main entry point: markdown string → Presentation
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Parse a markdown string into a Presentation
|
|
121
|
+
*/
|
|
122
|
+
declare function parseMarkdown(markdown: string): Presentation;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Theme type definitions
|
|
126
|
+
*/
|
|
127
|
+
interface ThemeGradient {
|
|
128
|
+
/** Gradient start color (hex, without '#') */
|
|
129
|
+
from: string;
|
|
130
|
+
/** Gradient end color (hex, without '#') */
|
|
131
|
+
to: string;
|
|
132
|
+
/** CSS-style angle: 0 = to top, 90 = to right, 180 = to bottom, 135 = to bottom-right */
|
|
133
|
+
angle?: number;
|
|
134
|
+
}
|
|
135
|
+
interface ThemeColors {
|
|
136
|
+
primary: string;
|
|
137
|
+
secondary: string;
|
|
138
|
+
background: string;
|
|
139
|
+
text: string;
|
|
140
|
+
accent: string;
|
|
141
|
+
codeBackground: string;
|
|
142
|
+
codeText: string;
|
|
143
|
+
titleBackground?: string;
|
|
144
|
+
titleText?: string;
|
|
145
|
+
/** Background color used to mark @(highlight=...) lines in code blocks */
|
|
146
|
+
highlightBackground?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Optional linear gradient stretched over the whole slide.
|
|
149
|
+
* When set it wins over `background` (and over `titleBackground` on cover slides);
|
|
150
|
+
* `background` stays as the flat fallback and drives dark/light detection for diagrams.
|
|
151
|
+
*/
|
|
152
|
+
backgroundGradient?: ThemeGradient;
|
|
153
|
+
}
|
|
154
|
+
interface ThemeFonts {
|
|
155
|
+
heading: string;
|
|
156
|
+
body: string;
|
|
157
|
+
code: string;
|
|
158
|
+
cjk: string;
|
|
159
|
+
}
|
|
160
|
+
interface ThemeFontSizes {
|
|
161
|
+
title: number;
|
|
162
|
+
heading: number;
|
|
163
|
+
body: number;
|
|
164
|
+
code: number;
|
|
165
|
+
small: number;
|
|
166
|
+
}
|
|
167
|
+
interface Theme {
|
|
168
|
+
name: string;
|
|
169
|
+
colors: ThemeColors;
|
|
170
|
+
fonts: ThemeFonts;
|
|
171
|
+
fontSize: ThemeFontSizes;
|
|
172
|
+
shikiTheme?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare const cleanTheme: Theme;
|
|
176
|
+
|
|
177
|
+
declare const academicTheme: Theme;
|
|
178
|
+
|
|
179
|
+
declare const darkTheme: Theme;
|
|
180
|
+
|
|
181
|
+
declare const businessTheme: Theme;
|
|
182
|
+
|
|
183
|
+
declare const warmTheme: Theme;
|
|
184
|
+
|
|
185
|
+
declare const defaultTheme: Theme;
|
|
186
|
+
|
|
187
|
+
declare const themes: Record<string, Theme>;
|
|
188
|
+
declare function getTheme(name?: string): Theme;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Diagram Registry
|
|
192
|
+
* Unified entry point for all diagram renderers
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
/** Check if a code block language is a diagram type */
|
|
196
|
+
declare function isDiagramLanguage(language: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Render a diagram code block to PNG
|
|
199
|
+
* @returns PNG image as Buffer
|
|
200
|
+
*/
|
|
201
|
+
declare function renderDiagram(language: string, code: string, theme?: Theme): Promise<Buffer>;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* MarkdownFly — Main orchestration
|
|
205
|
+
* Public API: convert(inputPath, options) → outputPath
|
|
206
|
+
*/
|
|
207
|
+
interface ConvertOptions {
|
|
208
|
+
output?: string;
|
|
209
|
+
theme?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Convert a Markdown file to PPTX
|
|
213
|
+
* @returns Absolute path of the generated .pptx file
|
|
214
|
+
*/
|
|
215
|
+
declare function convert(inputPath: string, options?: ConvertOptions): Promise<string>;
|
|
216
|
+
|
|
217
|
+
export { type ConvertOptions, type MarkdownFlyConfig, type Presentation, type SlideElement, type SlideNode, type Theme, academicTheme, businessTheme, cleanTheme, convert, darkTheme, defaultTheme, getTheme, isDiagramLanguage, parseMarkdown, renderDiagram, themes, warmTheme };
|