@md-plugins/shared 0.1.0-rc.1 → 0.1.0-rc.10
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/dist/index.d.mts +22 -6
- package/dist/index.d.ts +22 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Token from 'markdown-it/lib/token.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Escapes HTML-sensitive characters so text can be safely injected into markup.
|
|
5
5
|
*/
|
|
6
6
|
declare const htmlEscape: (str: string) => string;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Decodes the HTML entities emitted by {@link htmlEscape} and common numeric variants.
|
|
10
10
|
*/
|
|
11
11
|
declare const htmlUnescape: (str: string) => string;
|
|
12
12
|
|
|
@@ -62,9 +62,11 @@ interface ResolveTitleOptions {
|
|
|
62
62
|
shouldEscapeText: boolean;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Extracts plain heading text from a markdown-it inline token.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
67
|
+
* This is typically called with the inline token immediately after a
|
|
68
|
+
* `heading_open` token. Permalink marker tokens generated by markdown-it-anchor
|
|
69
|
+
* are ignored so the title remains human-readable.
|
|
68
70
|
*/
|
|
69
71
|
declare const resolveTitleFromToken: (token: Token, { shouldAllowHtml, shouldEscapeText }: ResolveTitleOptions) => string;
|
|
70
72
|
|
|
@@ -91,15 +93,29 @@ interface ResolveHeadersOptions extends ResolveTitleOptions {
|
|
|
91
93
|
format?: (str: string) => string | undefined;
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* Builds a nested heading tree from markdown-it heading tokens.
|
|
97
|
+
*
|
|
98
|
+
* Existing heading `id` attributes are preserved. When a heading has no `id`,
|
|
99
|
+
* the configured `slugify` function creates one from the resolved heading text.
|
|
95
100
|
*/
|
|
96
101
|
declare const resolveHeadersFromTokens: (tokens: Token[], { level, shouldAllowHtml, shouldAllowNested, shouldEscapeText, slugify, format, }?: Partial<ResolveHeadersOptions>) => MarkdownItHeader[];
|
|
97
102
|
|
|
98
103
|
/**
|
|
99
|
-
*
|
|
104
|
+
* Converts arbitrary heading text into a stable URL-friendly slug.
|
|
105
|
+
*
|
|
106
|
+
* The result is lowercase, accent-free, hyphen-separated, and safe to use as a
|
|
107
|
+
* generated Markdown heading id.
|
|
100
108
|
*/
|
|
101
109
|
declare const slugify: (str: string) => string;
|
|
102
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Resolves plugin options from either a direct options object or a nested
|
|
113
|
+
* package-level options bag.
|
|
114
|
+
*
|
|
115
|
+
* Markdown plugins can be configured directly through `md.use(plugin, options)`
|
|
116
|
+
* or through a shared md-plugins config object keyed by plugin name. This helper
|
|
117
|
+
* supports both shapes while applying default values.
|
|
118
|
+
*/
|
|
103
119
|
declare function resolvePluginOptions<T extends object, K extends keyof any>(options: T | {
|
|
104
120
|
[key in K]?: T;
|
|
105
121
|
} | undefined, key: K, defaults: T): T;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Token from 'markdown-it/lib/token.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Escapes HTML-sensitive characters so text can be safely injected into markup.
|
|
5
5
|
*/
|
|
6
6
|
declare const htmlEscape: (str: string) => string;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Decodes the HTML entities emitted by {@link htmlEscape} and common numeric variants.
|
|
10
10
|
*/
|
|
11
11
|
declare const htmlUnescape: (str: string) => string;
|
|
12
12
|
|
|
@@ -62,9 +62,11 @@ interface ResolveTitleOptions {
|
|
|
62
62
|
shouldEscapeText: boolean;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Extracts plain heading text from a markdown-it inline token.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
67
|
+
* This is typically called with the inline token immediately after a
|
|
68
|
+
* `heading_open` token. Permalink marker tokens generated by markdown-it-anchor
|
|
69
|
+
* are ignored so the title remains human-readable.
|
|
68
70
|
*/
|
|
69
71
|
declare const resolveTitleFromToken: (token: Token, { shouldAllowHtml, shouldEscapeText }: ResolveTitleOptions) => string;
|
|
70
72
|
|
|
@@ -91,15 +93,29 @@ interface ResolveHeadersOptions extends ResolveTitleOptions {
|
|
|
91
93
|
format?: (str: string) => string | undefined;
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* Builds a nested heading tree from markdown-it heading tokens.
|
|
97
|
+
*
|
|
98
|
+
* Existing heading `id` attributes are preserved. When a heading has no `id`,
|
|
99
|
+
* the configured `slugify` function creates one from the resolved heading text.
|
|
95
100
|
*/
|
|
96
101
|
declare const resolveHeadersFromTokens: (tokens: Token[], { level, shouldAllowHtml, shouldAllowNested, shouldEscapeText, slugify, format, }?: Partial<ResolveHeadersOptions>) => MarkdownItHeader[];
|
|
97
102
|
|
|
98
103
|
/**
|
|
99
|
-
*
|
|
104
|
+
* Converts arbitrary heading text into a stable URL-friendly slug.
|
|
105
|
+
*
|
|
106
|
+
* The result is lowercase, accent-free, hyphen-separated, and safe to use as a
|
|
107
|
+
* generated Markdown heading id.
|
|
100
108
|
*/
|
|
101
109
|
declare const slugify: (str: string) => string;
|
|
102
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Resolves plugin options from either a direct options object or a nested
|
|
113
|
+
* package-level options bag.
|
|
114
|
+
*
|
|
115
|
+
* Markdown plugins can be configured directly through `md.use(plugin, options)`
|
|
116
|
+
* or through a shared md-plugins config object keyed by plugin name. This helper
|
|
117
|
+
* supports both shapes while applying default values.
|
|
118
|
+
*/
|
|
103
119
|
declare function resolvePluginOptions<T extends object, K extends keyof any>(options: T | {
|
|
104
120
|
[key in K]?: T;
|
|
105
121
|
} | undefined, key: K, defaults: T): T;
|