fika-editor 3.0.24 → 3.0.25
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PPTCodeElement } from '../types/slides';
|
|
2
|
+
/**
|
|
3
|
+
* A .pptx has no code-block primitive, so a native code element travels as a
|
|
4
|
+
* text box whose shape name (`p:cNvPr@name`) carries this tag:
|
|
5
|
+
*
|
|
6
|
+
* fika:code:<language>[:<theme>[:<lineNumbers 0|1>]]
|
|
7
|
+
*
|
|
8
|
+
* Fika writes it on export and python-pptx2's `add_code` writes it when a deck
|
|
9
|
+
* is authored server-side; the importer turns any shape carrying it back into a
|
|
10
|
+
* syntax-highlighted code element instead of a plain text box.
|
|
11
|
+
*/
|
|
12
|
+
export declare const CODE_SHAPE_NAME_PREFIX = "fika:code";
|
|
13
|
+
export interface CodeShapeTag {
|
|
14
|
+
language: string;
|
|
15
|
+
theme: string;
|
|
16
|
+
showLineNumbers: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function formatCodeShapeName(el: Pick<PPTCodeElement, 'language' | 'theme' | 'showLineNumbers'>): string;
|
|
19
|
+
export declare function parseCodeShapeName(name: string | undefined | null): CodeShapeTag | null;
|
|
20
|
+
/**
|
|
21
|
+
* Source lines from imported paragraph HTML: one `<p>` per line, `<br>` as a
|
|
22
|
+
* hard break inside a paragraph, entities decoded, whitespace kept verbatim.
|
|
23
|
+
*/
|
|
24
|
+
export declare function htmlToCodeLines(html: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Export paints line numbers as literal text (`" 1 code"`); when the tag says
|
|
27
|
+
* the gutter is on, peel it off so the numbers are not doubled on re-import.
|
|
28
|
+
*/
|
|
29
|
+
export declare function stripCodeLineNumberGutter(lines: string[]): string[];
|
|
30
|
+
/** Imported paragraph HTML → code element source, honouring the tag's gutter flag. */
|
|
31
|
+
export declare function importedCodeSource(html: string, tag: CodeShapeTag): string;
|
|
32
|
+
/** The first run font size (pt) declared in imported paragraph HTML, scaled to px. */
|
|
33
|
+
export declare function importedCodeFontSize(html: string, ratio: number): number;
|