markdownfly 0.1.0 → 0.2.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/README.md +444 -289
- package/dist/cli.js +2840 -659
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +529 -12
- package/dist/index.js +2894 -662
- package/dist/index.js.map +1 -1
- package/package.json +78 -75
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
* Configuration type definitions
|
|
3
3
|
*/
|
|
4
4
|
interface MarkdownFlyConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Theme name for `getTheme` / CLI `-t`.
|
|
7
|
+
* Resolves ThemePreset first (e.g. 'blue'), then ColorScheme (e.g. 'ocean').
|
|
8
|
+
*/
|
|
5
9
|
theme: string;
|
|
10
|
+
/** ColorScheme override (frontmatter `color_scheme`) — overrides theme's color slot */
|
|
11
|
+
colorScheme?: string;
|
|
12
|
+
/** TextScheme override (frontmatter `text_scheme`) — overrides theme's text slot */
|
|
13
|
+
textScheme?: string;
|
|
14
|
+
/** LayoutScheme override (frontmatter `layout_scheme`) — overrides theme's layout slot */
|
|
15
|
+
layoutScheme?: string;
|
|
6
16
|
author?: string;
|
|
7
17
|
date?: string;
|
|
8
18
|
footer?: string;
|
|
@@ -18,7 +28,7 @@ interface MarkdownFlyConfig {
|
|
|
18
28
|
*/
|
|
19
29
|
|
|
20
30
|
/** Available slide layouts */
|
|
21
|
-
type SlideLayout = 'title' | 'section' | 'content' | 'two-column' | 'code' | 'quote' | 'blank' | 'closing';
|
|
31
|
+
type SlideLayout = 'title' | 'section' | 'content' | 'two-column' | 'code' | 'quote' | 'blank' | 'closing' | 'image-single' | 'image-double' | 'image-triple';
|
|
22
32
|
/** A layout marker inside a slide: starts a new row (===) or column (<->) */
|
|
23
33
|
interface BreakElement {
|
|
24
34
|
type: 'break';
|
|
@@ -121,9 +131,74 @@ interface Presentation {
|
|
|
121
131
|
*/
|
|
122
132
|
declare function parseMarkdown(markdown: string): Presentation;
|
|
123
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Text-set types — three layers: registry → TextScheme → shared FontStyleEntry.
|
|
136
|
+
*
|
|
137
|
+
* Policy (user decision): one scheme uses ONE typeface for Chinese and
|
|
138
|
+
* English alike. No sentence-level dual fonts, no OOXML a:ea rewrite.
|
|
139
|
+
* `cjkFace` remains only as an optional bridge hint for diagrams (`fonts.cjk`);
|
|
140
|
+
* when omitted, diagrams fall back to `face`.
|
|
141
|
+
*
|
|
142
|
+
* Compatibility: additive on Theme; existing fields unchanged.
|
|
143
|
+
* Entries carry no color (ColorScheme owns color) and no text transform.
|
|
144
|
+
*/
|
|
145
|
+
/** One font-style entry. `face` is the typeface used for all scripts. */
|
|
146
|
+
interface FontStyleEntry {
|
|
147
|
+
/** Typeface for this position (pptxgenjs `fontFace`) */
|
|
148
|
+
face: string;
|
|
149
|
+
/**
|
|
150
|
+
* Optional CJK hint for diagram bridge (`theme.fonts.cjk`).
|
|
151
|
+
* Omit for uniform schemes — bridge uses `face`.
|
|
152
|
+
*/
|
|
153
|
+
cjkFace?: string;
|
|
154
|
+
size: number;
|
|
155
|
+
bold?: boolean;
|
|
156
|
+
italic?: boolean;
|
|
157
|
+
underline?: boolean;
|
|
158
|
+
letterSpacing?: number;
|
|
159
|
+
lineSpacing?: number;
|
|
160
|
+
}
|
|
161
|
+
/** Fixed position keys — every TextScheme must supply all six. */
|
|
162
|
+
type TextSchemePositionKey = 'coverTitle' | 'slideTitle' | 'body' | 'quote' | 'code' | 'small';
|
|
163
|
+
declare const TEXT_SCHEME_POSITION_KEYS: readonly ["coverTitle", "slideTitle", "body", "quote", "code", "small"];
|
|
164
|
+
type TextSchemePositions = Record<TextSchemePositionKey, FontStyleEntry>;
|
|
165
|
+
interface TextScheme {
|
|
166
|
+
name: string;
|
|
167
|
+
/** Fixed six positions → FontStyleEntry (object references for sharing) */
|
|
168
|
+
positions: TextSchemePositions;
|
|
169
|
+
/** Documentation only */
|
|
170
|
+
note?: string;
|
|
171
|
+
}
|
|
172
|
+
declare const DEFAULT_TEXT_SCHEME_NAME = "system";
|
|
173
|
+
interface UniformTextSchemeOptions {
|
|
174
|
+
name: string;
|
|
175
|
+
/** Single typeface for titles, body, quote, small (CN + EN) */
|
|
176
|
+
face: string;
|
|
177
|
+
/** Code face; defaults to Consolas */
|
|
178
|
+
codeFace?: string;
|
|
179
|
+
/** Reuse a shared code entry (object identity) instead of creating one */
|
|
180
|
+
codeEntry?: FontStyleEntry;
|
|
181
|
+
sizes?: Partial<Record<TextSchemePositionKey, number>>;
|
|
182
|
+
/** Defaults: coverTitle + slideTitle bold */
|
|
183
|
+
bold?: Partial<Record<TextSchemePositionKey, boolean>>;
|
|
184
|
+
/** Defaults: quote italic */
|
|
185
|
+
italic?: Partial<Record<TextSchemePositionKey, boolean>>;
|
|
186
|
+
note?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Build a complete TextScheme from one typeface — the happy path for
|
|
190
|
+
* adding a scheme: one file + one registry line.
|
|
191
|
+
*/
|
|
192
|
+
declare function defineUniformTextScheme(options: UniformTextSchemeOptions): TextScheme;
|
|
193
|
+
|
|
124
194
|
/**
|
|
125
195
|
* Theme type definitions
|
|
196
|
+
*
|
|
197
|
+
* Compatibility: existing fields are never renamed, retyped, or removed.
|
|
198
|
+
* New capabilities are added as optional fields only; consumers fall back
|
|
199
|
+
* with `?? legacyField`. Deprecated fields keep a `@deprecated` JSDoc tag.
|
|
126
200
|
*/
|
|
201
|
+
|
|
127
202
|
interface ThemeGradient {
|
|
128
203
|
/** Gradient start color (hex, without '#') */
|
|
129
204
|
from: string;
|
|
@@ -150,12 +225,30 @@ interface ThemeColors {
|
|
|
150
225
|
* `background` stays as the flat fallback and drives dark/light detection for diagrams.
|
|
151
226
|
*/
|
|
152
227
|
backgroundGradient?: ThemeGradient;
|
|
228
|
+
/** Accent color group; prefer `accents[0]` over the legacy `accent` when both are set */
|
|
229
|
+
accents?: string[];
|
|
230
|
+
/** Subtitle text color; falls back to `secondary` */
|
|
231
|
+
subtitle?: string;
|
|
232
|
+
/** Divider / decoration-bar color; falls back to `primary` */
|
|
233
|
+
divider?: string;
|
|
234
|
+
/** Muted text (footnotes, annotations); falls back to `secondary` */
|
|
235
|
+
muted?: string;
|
|
236
|
+
/** Table header background; falls back to `primary` */
|
|
237
|
+
tableHeader?: string;
|
|
238
|
+
/** Table zebra-row background; falls back to `background` */
|
|
239
|
+
tableZebra?: string;
|
|
153
240
|
}
|
|
154
241
|
interface ThemeFonts {
|
|
155
242
|
heading: string;
|
|
156
243
|
body: string;
|
|
157
244
|
code: string;
|
|
158
245
|
cjk: string;
|
|
246
|
+
/** Cover-title face; falls back to `heading` */
|
|
247
|
+
title?: string;
|
|
248
|
+
/** Subtitle face; falls back to `heading` */
|
|
249
|
+
subtitle?: string;
|
|
250
|
+
/** Quote face; falls back to `body` */
|
|
251
|
+
quote?: string;
|
|
159
252
|
}
|
|
160
253
|
interface ThemeFontSizes {
|
|
161
254
|
title: number;
|
|
@@ -163,6 +256,98 @@ interface ThemeFontSizes {
|
|
|
163
256
|
body: number;
|
|
164
257
|
code: number;
|
|
165
258
|
small: number;
|
|
259
|
+
/** Subtitle size; falls back to `body` */
|
|
260
|
+
subtitle?: number;
|
|
261
|
+
/** Caption / table-note size; falls back to `small` */
|
|
262
|
+
caption?: number;
|
|
263
|
+
}
|
|
264
|
+
/** Layout parameters shared by all themes (data-parameter style, not coordinates) */
|
|
265
|
+
interface ThemeLayoutSpec {
|
|
266
|
+
/** Variant name interpreted by each layout function */
|
|
267
|
+
variant?: string;
|
|
268
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
269
|
+
/** Decoration-bar position; use 'none' to hide */
|
|
270
|
+
accentBar?: 'left' | 'bottom' | 'top' | 'none';
|
|
271
|
+
/** Title-zone height in inches */
|
|
272
|
+
titleHeight?: number;
|
|
273
|
+
/** Content-zone padding in inches */
|
|
274
|
+
contentPadding?: number;
|
|
275
|
+
/** Page margin in inches (overrides the layout's built-in MARGIN) */
|
|
276
|
+
margin?: number;
|
|
277
|
+
/** Whether to draw the footer divider line */
|
|
278
|
+
footerDivider?: boolean;
|
|
279
|
+
/** Free-form extras interpreted by individual layout functions */
|
|
280
|
+
extra?: Record<string, string | number | boolean>;
|
|
281
|
+
}
|
|
282
|
+
interface ThemeLayouts {
|
|
283
|
+
title?: ThemeLayoutSpec;
|
|
284
|
+
section?: ThemeLayoutSpec;
|
|
285
|
+
content?: ThemeLayoutSpec;
|
|
286
|
+
code?: ThemeLayoutSpec;
|
|
287
|
+
quote?: ThemeLayoutSpec;
|
|
288
|
+
closing?: ThemeLayoutSpec;
|
|
289
|
+
imageSingle?: ThemeLayoutSpec;
|
|
290
|
+
imageDouble?: ThemeLayoutSpec;
|
|
291
|
+
imageTriple?: ThemeLayoutSpec;
|
|
292
|
+
/** Footer geometry / divider (consumed by layouts/index.ts) */
|
|
293
|
+
footer?: ThemeLayoutSpec;
|
|
294
|
+
}
|
|
295
|
+
interface ThemeStyles {
|
|
296
|
+
/** Code-block corner radius in pt */
|
|
297
|
+
codeRadius?: number;
|
|
298
|
+
/** Code-block border color */
|
|
299
|
+
codeBorder?: string;
|
|
300
|
+
/** Whether the cover shows a corner badge / logo slot */
|
|
301
|
+
coverBadge?: boolean;
|
|
302
|
+
/** Section-page accent-bar width in inches */
|
|
303
|
+
sectionBarWidth?: number;
|
|
304
|
+
/** Whether non-cover pages draw a footer divider line */
|
|
305
|
+
footerDivider?: boolean;
|
|
306
|
+
}
|
|
307
|
+
/** Per-role text style; every property overrides the matching legacy field */
|
|
308
|
+
interface ThemeTextStyle {
|
|
309
|
+
face?: string;
|
|
310
|
+
size?: number;
|
|
311
|
+
color?: string;
|
|
312
|
+
bold?: boolean;
|
|
313
|
+
italic?: boolean;
|
|
314
|
+
/** Letter spacing in pt (pptxgenjs `charSpacing`) */
|
|
315
|
+
letterSpacing?: number;
|
|
316
|
+
/** Line-spacing multiplier (1.0 = single) */
|
|
317
|
+
lineSpacing?: number;
|
|
318
|
+
textTransform?: 'upper' | 'lower' | 'none';
|
|
319
|
+
}
|
|
320
|
+
/** Typographic styles organized by role; layout falls back to fonts/fontSize/colors */
|
|
321
|
+
interface ThemeTypography {
|
|
322
|
+
title?: ThemeTextStyle;
|
|
323
|
+
subtitle?: ThemeTextStyle;
|
|
324
|
+
heading?: ThemeTextStyle;
|
|
325
|
+
body?: ThemeTextStyle;
|
|
326
|
+
bodyStrong?: ThemeTextStyle;
|
|
327
|
+
bodyEm?: ThemeTextStyle;
|
|
328
|
+
code?: ThemeTextStyle;
|
|
329
|
+
inlineCode?: ThemeTextStyle;
|
|
330
|
+
quote?: ThemeTextStyle;
|
|
331
|
+
caption?: ThemeTextStyle;
|
|
332
|
+
footer?: ThemeTextStyle;
|
|
333
|
+
tableHeader?: ThemeTextStyle;
|
|
334
|
+
tableCell?: ThemeTextStyle;
|
|
335
|
+
}
|
|
336
|
+
/** Background resource: flat color, gradient, or image with optional overlay */
|
|
337
|
+
interface ThemeBackground {
|
|
338
|
+
type: 'color' | 'gradient' | 'image';
|
|
339
|
+
/** Used when type === 'color'; falls back to `colors.background` */
|
|
340
|
+
color?: string;
|
|
341
|
+
/** Used when type === 'gradient'; falls back to `colors.backgroundGradient` */
|
|
342
|
+
gradient?: ThemeGradient;
|
|
343
|
+
/** Used when type === 'image'; overlay keeps text readable */
|
|
344
|
+
image?: {
|
|
345
|
+
src: string;
|
|
346
|
+
/** Overlay hex color (e.g. 'FFFFFF' / '000000') */
|
|
347
|
+
overlay?: string;
|
|
348
|
+
/** Overlay opacity 0~1, default 0.35 */
|
|
349
|
+
overlayOpacity?: number;
|
|
350
|
+
};
|
|
166
351
|
}
|
|
167
352
|
interface Theme {
|
|
168
353
|
name: string;
|
|
@@ -170,43 +355,375 @@ interface Theme {
|
|
|
170
355
|
fonts: ThemeFonts;
|
|
171
356
|
fontSize: ThemeFontSizes;
|
|
172
357
|
shikiTheme?: string;
|
|
358
|
+
/** Per-layout visual parameters (optional; layouts fall back to built-in values) */
|
|
359
|
+
layouts?: ThemeLayouts;
|
|
360
|
+
/** Decoration / code-block styling knobs */
|
|
361
|
+
styles?: ThemeStyles;
|
|
362
|
+
/** Role-based typography overrides */
|
|
363
|
+
typography?: ThemeTypography;
|
|
364
|
+
/** Background resource pool (color / gradient / image+overlay) */
|
|
365
|
+
background?: ThemeBackground;
|
|
366
|
+
/** Reverse design traps for this theme (documentation only, not rendered) */
|
|
367
|
+
avoid?: string[];
|
|
368
|
+
/** Activated TextScheme name (e.g. 'system' / 'academic') */
|
|
369
|
+
textSet?: string;
|
|
370
|
+
/** Resolved TextScheme */
|
|
371
|
+
textScheme?: TextScheme;
|
|
372
|
+
/** Position → FontStyleEntry from the scheme (object references) */
|
|
373
|
+
textStyles?: Partial<Record<TextSchemePositionKey, FontStyleEntry>>;
|
|
374
|
+
/** Activated LayoutScheme name (e.g. 'folio' / 'legacy') */
|
|
375
|
+
layoutSet?: string;
|
|
376
|
+
/** Activated ThemePreset name when resolved via `preset` (e.g. 'tech-share') */
|
|
377
|
+
presetSet?: string;
|
|
173
378
|
}
|
|
174
379
|
|
|
175
|
-
|
|
380
|
+
/**
|
|
381
|
+
* ColorScheme — minimal user-facing palette for the PPT design system.
|
|
382
|
+
*
|
|
383
|
+
* A scheme is exactly four slots:
|
|
384
|
+
* ink — text (titles, body)
|
|
385
|
+
* paper — page background
|
|
386
|
+
* primary — main decoration bars / large color blocks
|
|
387
|
+
* secondary— auxiliary elements / secondary info
|
|
388
|
+
*
|
|
389
|
+
* Emphasis is expressed by weight, size, rules, and whitespace — not by an
|
|
390
|
+
* extra chromatic slot. `ThemeColors.accent` is still produced for legacy
|
|
391
|
+
* renderers, derived from primary (deeper mix toward ink).
|
|
392
|
+
*
|
|
393
|
+
* Built-in presets and user customs share this exact shape.
|
|
394
|
+
*/
|
|
395
|
+
type ColorSchemeMode = 'light' | 'dark';
|
|
396
|
+
interface ColorScheme {
|
|
397
|
+
/** Stable id, e.g. 'ocean' */
|
|
398
|
+
name: string;
|
|
399
|
+
/**
|
|
400
|
+
* Surface polarity hint (drives shiki default). Optional — inferred from
|
|
401
|
+
* paper luminance when omitted. Does NOT swap ink/paper: ink is always
|
|
402
|
+
* text, paper is always background.
|
|
403
|
+
*/
|
|
404
|
+
mode?: ColorSchemeMode;
|
|
405
|
+
/** Text color: titles + body */
|
|
406
|
+
ink: string;
|
|
407
|
+
/** Page background */
|
|
408
|
+
paper: string;
|
|
409
|
+
/** Primary: main decoration bars, large color blocks */
|
|
410
|
+
primary: string;
|
|
411
|
+
/** Secondary: auxiliary elements, secondary information */
|
|
412
|
+
secondary: string;
|
|
413
|
+
}
|
|
414
|
+
/** Chromatic slots exposed on ThemeColors.accents[] (emphasis is non-chromatic) */
|
|
415
|
+
declare const CHROMATIC_SLOTS: readonly ["primary", "secondary"];
|
|
416
|
+
/** light/dark from paper luminance (explicit mode wins); ink/paper are never swapped */
|
|
417
|
+
declare function resolveSchemeMode(scheme: ColorScheme): ColorSchemeMode;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* LayoutScheme — named package of layout parameters (placement only).
|
|
421
|
+
*
|
|
422
|
+
* Parallel to ColorScheme / TextScheme: registry → scheme → Theme.
|
|
423
|
+
* Does not carry fonts or colors; those stay in text-schemes / color-schemes.
|
|
424
|
+
*/
|
|
425
|
+
|
|
426
|
+
interface LayoutScheme {
|
|
427
|
+
/** Stable id, e.g. 'default' */
|
|
428
|
+
name: string;
|
|
429
|
+
/** Per-page-type placement parameters */
|
|
430
|
+
layouts: ThemeLayouts;
|
|
431
|
+
/** Decoration knobs shared across pages */
|
|
432
|
+
styles?: ThemeStyles;
|
|
433
|
+
/** Documentation only */
|
|
434
|
+
note?: string;
|
|
435
|
+
}
|
|
436
|
+
declare const DEFAULT_LAYOUT_SCHEME_NAME = "folio";
|
|
176
437
|
|
|
177
|
-
|
|
438
|
+
/**
|
|
439
|
+
* ThemePreset — named package selecting one ColorScheme × TextScheme × LayoutScheme.
|
|
440
|
+
*
|
|
441
|
+
* User-facing theme names resolve via `theme` / `-t`:
|
|
442
|
+
* ThemePreset first, then ColorScheme (legacy color-only path).
|
|
443
|
+
*/
|
|
444
|
+
interface ThemePreset {
|
|
445
|
+
/** Stable id used as the user-facing theme name, e.g. 'blue' */
|
|
446
|
+
name: string;
|
|
447
|
+
/** Registered ColorScheme name */
|
|
448
|
+
colorScheme: string;
|
|
449
|
+
/** Registered TextScheme name */
|
|
450
|
+
textScheme: string;
|
|
451
|
+
/** Registered LayoutScheme name */
|
|
452
|
+
layoutScheme: string;
|
|
453
|
+
/** Reserved for step 4 background-set — not consumed yet */
|
|
454
|
+
backgroundScheme?: string;
|
|
455
|
+
/** Documentation only */
|
|
456
|
+
note?: string;
|
|
457
|
+
}
|
|
458
|
+
/** Default theme when `-t` / frontmatter `theme` is omitted. */
|
|
459
|
+
declare const DEFAULT_THEME_NAME = "blue";
|
|
460
|
+
/** @deprecated Use DEFAULT_THEME_NAME; kept as alias for older imports. */
|
|
461
|
+
declare const DEFAULT_PRESET_NAME = "blue";
|
|
178
462
|
|
|
179
|
-
|
|
463
|
+
/**
|
|
464
|
+
* Resolve a compact ColorScheme (ink/paper/primary/secondary) into ThemeColors.
|
|
465
|
+
*
|
|
466
|
+
* Compatibility: output uses only current ThemeColors fields. Renderer and
|
|
467
|
+
* diagrams/theme.ts (isDarkTheme → colors.background) keep working unchanged.
|
|
468
|
+
* background is always a bare hex without '#'.
|
|
469
|
+
*
|
|
470
|
+
* Role contract (author-facing, never swapped):
|
|
471
|
+
* paper → colors.background
|
|
472
|
+
* ink → colors.text
|
|
473
|
+
*
|
|
474
|
+
* `accent` is required on ThemeColors but is NOT a ColorScheme slot — it is
|
|
475
|
+
* derived (primary mixed toward ink) so existing accent consumers keep working
|
|
476
|
+
* while the authored palette stays at four colors.
|
|
477
|
+
*/
|
|
180
478
|
|
|
181
|
-
declare
|
|
479
|
+
declare function resolveColorScheme(scheme: ColorScheme): ThemeColors;
|
|
182
480
|
|
|
183
|
-
|
|
481
|
+
/**
|
|
482
|
+
* Build a full Theme from a ColorScheme (+ optional font / text-set overrides).
|
|
483
|
+
*
|
|
484
|
+
* Text-set layer is the only font source: `textScheme` (default `system`)
|
|
485
|
+
* bridges into Theme.fonts / Theme.fontSize. Explicit `options.fonts` /
|
|
486
|
+
* `options.fontSize` still win when provided.
|
|
487
|
+
*
|
|
488
|
+
* The legacy `font-sets/` folder has been removed; do not reintroduce it.
|
|
489
|
+
*/
|
|
184
490
|
|
|
185
|
-
|
|
491
|
+
interface ThemeFromSchemeOptions {
|
|
492
|
+
fonts?: ThemeFonts;
|
|
493
|
+
fontSize?: ThemeFontSizes;
|
|
494
|
+
shikiTheme?: string;
|
|
495
|
+
layouts?: Theme['layouts'];
|
|
496
|
+
styles?: Theme['styles'];
|
|
497
|
+
typography?: Theme['typography'];
|
|
498
|
+
avoid?: string[];
|
|
499
|
+
/** Color scheme name or object; defaults to the `scheme` argument */
|
|
500
|
+
colorScheme?: string | ColorScheme;
|
|
501
|
+
/** Text scheme name or object; defaults to `system` */
|
|
502
|
+
textScheme?: string | TextScheme;
|
|
503
|
+
/** Layout scheme name or object; omitted → layouts/styles stay unset (legacy) */
|
|
504
|
+
layoutScheme?: string | LayoutScheme;
|
|
505
|
+
/** ThemePreset name for provenance (`theme.presetSet`); does not drive slots here */
|
|
506
|
+
presetSet?: string;
|
|
507
|
+
}
|
|
508
|
+
/** Resolve preset option → object; unknown name warns and returns undefined. */
|
|
509
|
+
declare function resolveThemePresetOption(input?: string | ThemePreset): ThemePreset | undefined;
|
|
510
|
+
declare function createThemeFromScheme(scheme: ColorScheme, options?: ThemeFromSchemeOptions): Theme;
|
|
186
511
|
|
|
187
|
-
|
|
188
|
-
|
|
512
|
+
/**
|
|
513
|
+
* Ocean(海洋)— 单色克制蓝。
|
|
514
|
+
* ink 深海墨蓝作文字,paper 近白海沫作底,primary 亮蓝主装饰,
|
|
515
|
+
* secondary 中蓝辅助。强调靠字重/字号/线条,不额外占彩槽。
|
|
516
|
+
*/
|
|
517
|
+
declare const oceanScheme: ColorScheme;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Ocean Dark(深海)— ocean 的暗色对位。
|
|
521
|
+
* paper 深海作底,ink 浅沫作字;primary/secondary 提亮以保证深底对比。
|
|
522
|
+
* 代码块底为派生深色面板 + github-dark 高亮。
|
|
523
|
+
*/
|
|
524
|
+
declare const oceanDarkScheme: ColorScheme;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Built-in ColorScheme registry.
|
|
528
|
+
*
|
|
529
|
+
* Convention: one scheme per file in this folder (`kebab-case.ts`), each
|
|
530
|
+
* exporting a single `ColorScheme`. To add a built-in scheme:
|
|
531
|
+
* 1. create `color-schemes/<name>.ts` exporting `{name}Scheme`
|
|
532
|
+
* 2. import it below and append to `builtInSchemes`
|
|
533
|
+
*
|
|
534
|
+
* Step 2 is the only registry touch; values never live in this file.
|
|
535
|
+
* `test/color-schemes-folder.test.ts` fails if a scheme file is not registered.
|
|
536
|
+
*/
|
|
537
|
+
|
|
538
|
+
declare function getColorScheme(name?: string): ColorScheme | undefined;
|
|
539
|
+
declare function listColorSchemes(): ColorScheme[];
|
|
540
|
+
declare function registerColorScheme(scheme: ColorScheme): void;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* academic TextScheme — uniform typeface: 宋体.
|
|
544
|
+
* Titles sized up for the `blue` theme package (user request).
|
|
545
|
+
*/
|
|
546
|
+
declare const academicTextScheme: TextScheme;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* system TextScheme — default. Uniform typeface: 微软雅黑.
|
|
550
|
+
* code 位置使用共享 Consolas 条目。
|
|
551
|
+
*/
|
|
552
|
+
declare const systemTextScheme: TextScheme;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* kai TextScheme — uniform typeface: KaiTi(楷体).
|
|
556
|
+
*/
|
|
557
|
+
declare const kaiTextScheme: TextScheme;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* source-han-serif TextScheme — uniform typeface: 思源宋体.
|
|
561
|
+
* 本机安装名也可能是 Source Han Serif SC / Noto Serif CJK SC,不一致时改 face。
|
|
562
|
+
*/
|
|
563
|
+
declare const sourceHanSerifTextScheme: TextScheme;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Built-in TextScheme registry.
|
|
567
|
+
*
|
|
568
|
+
* Add a scheme (two steps):
|
|
569
|
+
* 1. create `text-schemes/<name>.ts` exporting a TextScheme
|
|
570
|
+
* (usually via `defineUniformTextScheme({ name, face, codeEntry: sharedCode })`)
|
|
571
|
+
* 2. import it below and append to `builtInTextSchemes`
|
|
572
|
+
*
|
|
573
|
+
* `test/text-schemes-folder.test.ts` fails if a scheme file is not registered.
|
|
574
|
+
*/
|
|
575
|
+
|
|
576
|
+
declare const textSchemes: Record<string, TextScheme>;
|
|
577
|
+
declare function getTextScheme(name?: string): TextScheme | undefined;
|
|
578
|
+
declare function listTextSchemes(): TextScheme[];
|
|
579
|
+
declare function registerTextScheme(scheme: TextScheme): void;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* folio LayoutScheme — 编辑册页风(创新版式,不仿 legacy)。
|
|
583
|
+
*
|
|
584
|
+
* 设计语言:杂志/技术报告册页
|
|
585
|
+
* - 封面:左侧书脊色带 + 左对齐标题 + 标题下短横线 + 元信息沉底
|
|
586
|
+
* - 章节:无侧边条;上下双横线夹住标题带
|
|
587
|
+
* - 正文:不对称页边距(左宽右窄)+ 标题下粗线(次级色)
|
|
588
|
+
* - 代码:近满幅「图版」式
|
|
589
|
+
* - 引用:左侧竖条 pull-quote,无大引号,出处左对齐
|
|
590
|
+
* - 页脚:分割线 + 居中
|
|
591
|
+
* - 结尾:Thank you 上下短线
|
|
592
|
+
* - 图文:与正文同款不对称边距
|
|
593
|
+
*/
|
|
594
|
+
|
|
595
|
+
declare const folioLayoutScheme: LayoutScheme;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* legacy LayoutScheme — 旧版版式(改造前写死在 layout 函数里的那套)。
|
|
599
|
+
*
|
|
600
|
+
* 仅覆盖旧有基础页:封面 / 章节 / 正文 / 代码 / 引用 + 页脚。
|
|
601
|
+
* 不含结尾页、图文页——使用本方案时,新页型走 layout 函数内硬编码默认。
|
|
602
|
+
*/
|
|
603
|
+
|
|
604
|
+
declare const legacyLayoutScheme: LayoutScheme;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Built-in LayoutScheme registry — 主题体系中的版式集。
|
|
608
|
+
*
|
|
609
|
+
* 数据流与色彩集 / 文字集相同:
|
|
610
|
+
* layout-schemes/<name>/ → getTheme(..., { layoutScheme }) → Theme.layouts/styles
|
|
611
|
+
*
|
|
612
|
+
* 一套版式方案 = 一个文件夹。内置:
|
|
613
|
+
* - legacy:旧版(改造前写死摆法)
|
|
614
|
+
* - folio:编辑册页(创新版式,不仿 legacy)
|
|
615
|
+
* - golden:黄金比例(右对齐留白 + 黄金分割横线)
|
|
616
|
+
* - minimal:极简档案(统一 0.83 边距 + 线性装饰 + 超大章序号)
|
|
617
|
+
*
|
|
618
|
+
* `test/layout-schemes-folder.test.ts`:文件夹 ↔ 注册表一致性。
|
|
619
|
+
*/
|
|
620
|
+
|
|
621
|
+
declare const layoutSchemes: Record<string, LayoutScheme>;
|
|
622
|
+
declare function getLayoutScheme(name?: string): LayoutScheme | undefined;
|
|
623
|
+
declare function listLayoutSchemes(): LayoutScheme[];
|
|
624
|
+
declare function registerLayoutScheme(scheme: LayoutScheme): void;
|
|
625
|
+
|
|
626
|
+
/** blue:ocean + academic + legacy */
|
|
627
|
+
declare const bluePreset: ThemePreset;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Built-in ThemePreset registry — 主题预设(色彩 × 文字 × 版式 组合包)。
|
|
631
|
+
*
|
|
632
|
+
* 数据流:
|
|
633
|
+
* presets/<name>.ts → getTheme(..., { preset }) / convert(..., { preset }) → Theme
|
|
634
|
+
*
|
|
635
|
+
* 契约(第 5 步拍板):
|
|
636
|
+
* - `-t` / frontmatter `theme:` 仍只表示 ColorScheme 名
|
|
637
|
+
* - 预设走独立入口 `preset` / `--preset`;不传 = 现网行为(不自动套默认预设)
|
|
638
|
+
* - 显式 textScheme / layoutScheme / theme 覆盖预设对应槽位
|
|
639
|
+
*
|
|
640
|
+
* 内置 4 套预设(色彩 × 文字 × 版式,各集不重复按顺序组合):
|
|
641
|
+
* - blue = ocean + academic + legacy
|
|
642
|
+
* - emerald = forest + system + folio
|
|
643
|
+
* - gold = champagne + kai + golden
|
|
644
|
+
* - slate = graphite + source-han-serif + minimal
|
|
645
|
+
* (ocean-dark 为 ocean 的反色,与 ocean 共用文字/版式,不单列)
|
|
646
|
+
*/
|
|
647
|
+
|
|
648
|
+
declare const themePresets: Record<string, ThemePreset>;
|
|
649
|
+
declare function getThemePreset(name?: string): ThemePreset | undefined;
|
|
650
|
+
declare function listThemePresets(): ThemePreset[];
|
|
651
|
+
declare function registerThemePreset(preset: ThemePreset): void;
|
|
652
|
+
declare function themePresetNames(): string[];
|
|
653
|
+
declare function hasThemePreset(name?: string): boolean;
|
|
654
|
+
|
|
655
|
+
/** Color-only fallback when a ColorScheme name is unknown */
|
|
656
|
+
declare const DEFAULT_SCHEME_NAME = "ocean";
|
|
657
|
+
interface GetThemeOptions {
|
|
658
|
+
/** Color scheme name or resolved ColorScheme (overrides preset slot) */
|
|
659
|
+
colorScheme?: string | ColorScheme;
|
|
660
|
+
/** Text scheme name or resolved TextScheme (overrides preset slot) */
|
|
661
|
+
textScheme?: string | TextScheme;
|
|
662
|
+
/** Layout scheme name or resolved LayoutScheme (overrides preset slot) */
|
|
663
|
+
layoutScheme?: string | LayoutScheme;
|
|
664
|
+
/**
|
|
665
|
+
* Optional ThemePreset object for advanced callers.
|
|
666
|
+
* The user-facing path is the `name` argument (`-t` / frontmatter `theme`).
|
|
667
|
+
*/
|
|
668
|
+
preset?: string | ThemePreset;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Build a Theme from a user-facing theme name.
|
|
672
|
+
*
|
|
673
|
+
* - `blue` (or any ThemePreset) → full package (color × text × layout)
|
|
674
|
+
* - `ocean` / `ocean-dark` (ColorScheme only) → color path; text `system`;
|
|
675
|
+
* layouts stay unset unless `options.layoutScheme` is passed
|
|
676
|
+
* - omitted / unknown → default theme `blue` (unknown warns)
|
|
677
|
+
*
|
|
678
|
+
* Non-string `name` values still throw (CLI contract).
|
|
679
|
+
*/
|
|
680
|
+
declare function getTheme(name?: string, options?: GetThemeOptions): Theme;
|
|
681
|
+
/** User-facing theme names: presets first, then color-only schemes. */
|
|
682
|
+
declare function themeNames(): string[];
|
|
683
|
+
/** Whether `name` is a known user-facing theme (preset or color scheme). */
|
|
684
|
+
declare function hasTheme(name?: string): boolean;
|
|
685
|
+
|
|
686
|
+
/** Check if a code block language is a diagram type. */
|
|
687
|
+
declare function isDiagramLanguage(language: string): boolean;
|
|
189
688
|
|
|
190
689
|
/**
|
|
191
690
|
* Diagram Registry
|
|
192
691
|
* Unified entry point for all diagram renderers
|
|
193
692
|
*/
|
|
194
693
|
|
|
195
|
-
/** Check if a code block language is a diagram type */
|
|
196
|
-
declare function isDiagramLanguage(language: string): boolean;
|
|
197
694
|
/**
|
|
198
695
|
* Render a diagram code block to PNG
|
|
199
696
|
* @returns PNG image as Buffer
|
|
200
697
|
*/
|
|
201
698
|
declare function renderDiagram(language: string, code: string, theme?: Theme): Promise<Buffer>;
|
|
202
699
|
|
|
700
|
+
/**
|
|
701
|
+
* PPTX Renderer
|
|
702
|
+
* Orchestrates pptxgenjs to produce .pptx files from Presentation
|
|
703
|
+
*/
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Render a Presentation to a .pptx file
|
|
707
|
+
*/
|
|
708
|
+
declare function renderPresentation(presentation: Presentation, theme: Theme, outputPath: string, inputPath?: string): Promise<void>;
|
|
709
|
+
|
|
203
710
|
/**
|
|
204
711
|
* MarkdownFly — Main orchestration
|
|
205
712
|
* Public API: convert(inputPath, options) → outputPath
|
|
206
713
|
*/
|
|
207
714
|
interface ConvertOptions {
|
|
208
715
|
output?: string;
|
|
716
|
+
/**
|
|
717
|
+
* User-facing theme name (same as CLI `-t` / frontmatter `theme`).
|
|
718
|
+
* ThemePreset first (e.g. 'blue'), then ColorScheme (e.g. 'ocean').
|
|
719
|
+
*/
|
|
209
720
|
theme?: string;
|
|
721
|
+
/** ColorScheme override (CLI `--color` / frontmatter `color_scheme`) */
|
|
722
|
+
colorScheme?: string;
|
|
723
|
+
/** TextScheme override (CLI `--text` / frontmatter `text_scheme`) */
|
|
724
|
+
textScheme?: string;
|
|
725
|
+
/** LayoutScheme override (CLI `--layout` / frontmatter `layout_scheme`) */
|
|
726
|
+
layoutScheme?: string;
|
|
210
727
|
}
|
|
211
728
|
/**
|
|
212
729
|
* Convert a Markdown file to PPTX
|
|
@@ -214,4 +731,4 @@ interface ConvertOptions {
|
|
|
214
731
|
*/
|
|
215
732
|
declare function convert(inputPath: string, options?: ConvertOptions): Promise<string>;
|
|
216
733
|
|
|
217
|
-
export { type ConvertOptions, type MarkdownFlyConfig, type Presentation, type SlideElement, type SlideNode, type Theme,
|
|
734
|
+
export { CHROMATIC_SLOTS, type ColorScheme, type ColorSchemeMode, type ConvertOptions, DEFAULT_LAYOUT_SCHEME_NAME, DEFAULT_PRESET_NAME, DEFAULT_SCHEME_NAME, DEFAULT_TEXT_SCHEME_NAME, DEFAULT_THEME_NAME, type FontStyleEntry, type LayoutScheme, type MarkdownFlyConfig, type Presentation, type SlideElement, type SlideNode, TEXT_SCHEME_POSITION_KEYS, type TextScheme, type TextSchemePositionKey, type Theme, type ThemePreset, type UniformTextSchemeOptions, academicTextScheme, bluePreset, convert, createThemeFromScheme, defineUniformTextScheme, folioLayoutScheme, getColorScheme, getLayoutScheme, getTextScheme, getTheme, getThemePreset, hasTheme, hasThemePreset, isDiagramLanguage, kaiTextScheme, layoutSchemes, legacyLayoutScheme, listColorSchemes, listLayoutSchemes, listTextSchemes, listThemePresets, oceanDarkScheme, oceanScheme, parseMarkdown, registerColorScheme, registerLayoutScheme, registerTextScheme, registerThemePreset, renderDiagram, renderPresentation, resolveColorScheme, resolveSchemeMode, resolveThemePresetOption, sourceHanSerifTextScheme, systemTextScheme, textSchemes, themeNames, themePresetNames, themePresets };
|