quikdown 1.0.3 → 1.0.5

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,112 @@
1
+ /**
2
+ * quikdown_bd - Bidirectional Markdown Parser
3
+ * TypeScript definitions
4
+ */
5
+
6
+ declare module 'quikdown/bd' {
7
+ /**
8
+ * Options for configuring the quikdown_bd parser
9
+ */
10
+ export interface QuikdownBdOptions {
11
+ /**
12
+ * Custom renderer for fenced code blocks.
13
+ * Return undefined to use default rendering.
14
+ * @param content - The code block content (unescaped)
15
+ * @param language - The language identifier (or empty string)
16
+ * @returns HTML string or undefined for default rendering
17
+ */
18
+ fence_plugin?: (content: string, language: string) => string | undefined;
19
+
20
+ /**
21
+ * If true, uses inline styles instead of CSS classes.
22
+ * Useful for emails or environments without CSS support.
23
+ * @default false
24
+ */
25
+ inline_styles?: boolean;
26
+
27
+ /**
28
+ * If true, allows potentially unsafe URLs (javascript:, data:, etc).
29
+ * Only use with trusted content.
30
+ * @default false
31
+ */
32
+ allow_unsafe_urls?: boolean;
33
+
34
+ /**
35
+ * Always true for quikdown_bd - adds data-qd attributes for bidirectional conversion.
36
+ * @default true
37
+ */
38
+ bidirectional?: boolean;
39
+
40
+ /**
41
+ * If true, single newlines become <br> tags.
42
+ * Useful for chat/LLM applications where Enter should create a line break.
43
+ * @default false
44
+ */
45
+ lazy_linefeeds?: boolean;
46
+ }
47
+
48
+ /**
49
+ * Parse markdown to HTML with bidirectional support
50
+ * @param markdown - The markdown source text
51
+ * @param options - Optional configuration
52
+ * @returns The rendered HTML string with data-qd attributes
53
+ */
54
+ function quikdown_bd(markdown: string, options?: QuikdownBdOptions): string;
55
+
56
+ namespace quikdown_bd {
57
+ /**
58
+ * Convert HTML back to Markdown
59
+ * @param htmlOrElement - HTML string or DOM element to convert
60
+ * @returns The recovered markdown string
61
+ */
62
+ export function toMarkdown(htmlOrElement: string | HTMLElement): string;
63
+
64
+ /**
65
+ * Generate CSS styles for quikdown classes with theme support
66
+ * @param prefix - CSS class prefix (default: 'quikdown-')
67
+ * @param theme - Theme name: 'light' (default) or 'dark'
68
+ * @returns CSS string with themed .quikdown-* styles
69
+ */
70
+ export function emitStyles(prefix?: string, theme?: 'light' | 'dark'): string;
71
+
72
+ /**
73
+ * Create a configured parser function with preset options
74
+ * @param options - Configuration to apply to all parsing
75
+ * @returns A parser function with the options pre-applied
76
+ */
77
+ export function configure(options: QuikdownBdOptions): (markdown: string) => string;
78
+
79
+ /**
80
+ * The version of quikdown_bd (same as core quikdown)
81
+ */
82
+ export const version: string;
83
+ }
84
+
85
+ export = quikdown_bd;
86
+ }
87
+
88
+ // For ES6 module imports
89
+ export default quikdown_bd;
90
+ export { QuikdownBdOptions };
91
+
92
+ /**
93
+ * Default export for direct import
94
+ */
95
+ declare function quikdown_bd(markdown: string, options?: QuikdownBdOptions): string;
96
+
97
+ declare namespace quikdown_bd {
98
+ export function toMarkdown(htmlOrElement: string | HTMLElement): string;
99
+ export function emitStyles(prefix?: string, theme?: 'light' | 'dark'): string;
100
+ export function configure(options: QuikdownBdOptions): (markdown: string) => string;
101
+ export const version: string;
102
+ }
103
+
104
+ export interface QuikdownBdOptions {
105
+ fence_plugin?: (content: string, language: string) => string | undefined;
106
+ inline_styles?: boolean;
107
+ allow_unsafe_urls?: boolean;
108
+ bidirectional?: boolean;
109
+ lazy_linefeeds?: boolean;
110
+ }
111
+
112
+ export default quikdown_bd;