@mdit-vue/plugin-headers 0.12.0 → 0.12.1
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.cts +54 -0
- package/dist/index.d.mts +54 -0
- package/dist/index.d.ts +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import MarkdownIt from 'markdown-it';
|
|
2
|
+
import { MarkdownItHeader } from '@mdit-vue/types';
|
|
3
|
+
export { MarkdownItHeader } from '@mdit-vue/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options of @mdit-vue/plugin-headers
|
|
7
|
+
*/
|
|
8
|
+
interface HeadersPluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* A custom slugification function
|
|
11
|
+
*
|
|
12
|
+
* Should use the same slugify function with markdown-it-anchor
|
|
13
|
+
* to ensure the link is matched
|
|
14
|
+
*/
|
|
15
|
+
slugify?: (str: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* A function for formatting header title
|
|
18
|
+
*/
|
|
19
|
+
format?: (str: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Heading level that going to be extracted
|
|
22
|
+
*
|
|
23
|
+
* Should be a subset of markdown-it-anchor's `level` option
|
|
24
|
+
* to ensure the slug is existed
|
|
25
|
+
*
|
|
26
|
+
* @default [2,3]
|
|
27
|
+
*/
|
|
28
|
+
level?: number[];
|
|
29
|
+
/**
|
|
30
|
+
* Should allow headers inside nested blocks or not
|
|
31
|
+
*
|
|
32
|
+
* If set to `true`, headers inside blockquote, list, etc. would also be extracted.
|
|
33
|
+
*
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
shouldAllowNested?: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare module '@mdit-vue/types' {
|
|
39
|
+
interface MarkdownItEnv {
|
|
40
|
+
/**
|
|
41
|
+
* The headers that extracted by `@mdit-vue/plugin-headers`
|
|
42
|
+
*/
|
|
43
|
+
headers?: MarkdownItHeader[];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get markdown headers info
|
|
49
|
+
*
|
|
50
|
+
* Extract them into env
|
|
51
|
+
*/
|
|
52
|
+
declare const headersPlugin: MarkdownIt.PluginWithOptions<HeadersPluginOptions>;
|
|
53
|
+
|
|
54
|
+
export { type HeadersPluginOptions, headersPlugin };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import MarkdownIt from 'markdown-it';
|
|
2
|
+
import { MarkdownItHeader } from '@mdit-vue/types';
|
|
3
|
+
export { MarkdownItHeader } from '@mdit-vue/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options of @mdit-vue/plugin-headers
|
|
7
|
+
*/
|
|
8
|
+
interface HeadersPluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* A custom slugification function
|
|
11
|
+
*
|
|
12
|
+
* Should use the same slugify function with markdown-it-anchor
|
|
13
|
+
* to ensure the link is matched
|
|
14
|
+
*/
|
|
15
|
+
slugify?: (str: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* A function for formatting header title
|
|
18
|
+
*/
|
|
19
|
+
format?: (str: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Heading level that going to be extracted
|
|
22
|
+
*
|
|
23
|
+
* Should be a subset of markdown-it-anchor's `level` option
|
|
24
|
+
* to ensure the slug is existed
|
|
25
|
+
*
|
|
26
|
+
* @default [2,3]
|
|
27
|
+
*/
|
|
28
|
+
level?: number[];
|
|
29
|
+
/**
|
|
30
|
+
* Should allow headers inside nested blocks or not
|
|
31
|
+
*
|
|
32
|
+
* If set to `true`, headers inside blockquote, list, etc. would also be extracted.
|
|
33
|
+
*
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
shouldAllowNested?: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare module '@mdit-vue/types' {
|
|
39
|
+
interface MarkdownItEnv {
|
|
40
|
+
/**
|
|
41
|
+
* The headers that extracted by `@mdit-vue/plugin-headers`
|
|
42
|
+
*/
|
|
43
|
+
headers?: MarkdownItHeader[];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get markdown headers info
|
|
49
|
+
*
|
|
50
|
+
* Extract them into env
|
|
51
|
+
*/
|
|
52
|
+
declare const headersPlugin: MarkdownIt.PluginWithOptions<HeadersPluginOptions>;
|
|
53
|
+
|
|
54
|
+
export { type HeadersPluginOptions, headersPlugin };
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdit-vue/plugin-headers",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "A markdown-it plugin to get markdown headers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"test": "vitest"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@mdit-vue/shared": "0.12.
|
|
41
|
+
"@mdit-vue/shared": "0.12.1",
|
|
42
42
|
"@mdit-vue/types": "0.12.0",
|
|
43
|
-
"@types/markdown-it": "^
|
|
43
|
+
"@types/markdown-it": "^13.0.0",
|
|
44
44
|
"markdown-it": "^13.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"markdown-it-anchor": "^8.6.
|
|
47
|
+
"markdown-it-anchor": "^8.6.7"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "198a71b2e4175a92843609a63d2a848bddb71740"
|
|
53
53
|
}
|