@powerduck/md-editor 0.3.0 → 0.6.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.
@@ -1,5 +1,5 @@
1
- import type MarkdownIt from 'markdown-it';
2
- import 'highlight.js/styles/atom-one-dark.css';
1
+ import type { MarkdownIt } from "markdown-it";
2
+ import "highlight.js/styles/atom-one-dark.css";
3
3
  export interface CodeHighlightOptions {
4
4
  /** Languages to skip (delegate to the previously-registered renderer). Default: ['mindmap']. */
5
5
  reservedLanguages?: readonly string[];
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Keyboard shortcut manager for the editor.
3
+ * Maps key combinations to action names. Used by the toolbar to wire up
4
+ * shortcuts and by the Help dialog to display them.
5
+ */
6
+ export interface ShortcutDef {
7
+ action: string;
8
+ /** e.g. 'Mod-b' where Mod = Ctrl on Windows/Linux, Cmd on macOS */
9
+ key: string;
10
+ description: string;
11
+ }
12
+ export declare const DEFAULT_SHORTCUTS: readonly ShortcutDef[];
13
+ /**
14
+ * Parse a shortcut string like 'Mod-b' or 'Mod-Alt-1' into a matcher function.
15
+ * 'Mod' maps to Meta (Cmd) on macOS and Ctrl elsewhere.
16
+ */
17
+ export declare function matchShortcut(shortcut: string, e: KeyboardEvent): boolean;
18
+ /**
19
+ * Format a shortcut for display in the Help dialog.
20
+ * e.g. 'Mod-b' -> 'Ctrl+B' (Windows) or 'Cmd+B' (macOS)
21
+ */
22
+ export declare function formatShortcut(shortcut: string): string;
23
+ /**
24
+ * Format a shortcut as HTML with styled kbd elements.
25
+ * Modifier keys get symbol icons (⌘, ⌥, ⇧) on macOS.
26
+ */
27
+ export declare function formatShortcutHtml(shortcut: string): string;
@@ -1,7 +1,3 @@
1
1
  import type MarkdownIt from 'markdown-it';
2
- /**
3
- * Enable math formula support via KaTeX.
4
- * Inline: $E=mc^2$
5
- * Block: $$ \\int_0^1 x^2 dx $$
6
- */
2
+ import 'katex/dist/katex.min.css';
7
3
  export declare function useMath(md: MarkdownIt): void;
@@ -1,4 +1,4 @@
1
- import type MarkdownIt from 'markdown-it';
1
+ import type { MarkdownIt } from "markdown-it";
2
2
  /**
3
3
  * Intercept ```mindmap code fences and convert their content (a markdown
4
4
  * outline) into a placeholder div. The actual SVG rendering happens
@@ -25,5 +25,10 @@ export declare function useMindmap(md: MarkdownIt): void;
25
25
  * Markmap.create is called. markmap-view's d3-zoom gesture reads
26
26
  * svg.width.baseVal.value, which throws "Could not resolve relative length"
27
27
  * when the SVG only has percentage-based CSS dimensions (width:100%).
28
+ *
29
+ * IMPORTANT 2: autoFit must be false at creation time. The SVG is appended
30
+ * synchronously but the browser has not laid it out yet, so getBoundingClientRect
31
+ * returns 0x0 and markmap computes translate(NaN,NaN). We defer fit() to the
32
+ * next animation frame when layout is complete.
28
33
  */
29
34
  export declare function hydrateMindmaps(root: HTMLElement): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { MarkdownIt } from "markdown-it";
2
+ export declare function useTips(md: MarkdownIt): void;
@@ -1,4 +1,4 @@
1
- import type MarkdownIt from 'markdown-it';
1
+ import type { MarkdownIt } from "markdown-it";
2
2
  /**
3
3
  * Override the markdown-it image renderer to detect video file URLs
4
4
  * (.mp4, .webm, .ogg, etc.) and render them as <video> elements instead