@mdit-vue/plugin-toc 2.1.3 → 2.1.4
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.cjs +2 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +2 -4
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -33,10 +33,8 @@ const createTocBlockRule = ({
|
|
|
33
33
|
const pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
34
34
|
const max = state.eMarks[startLine];
|
|
35
35
|
const lineFirstToken = state.src.slice(pos, max).split(" ")[0];
|
|
36
|
-
if (!pattern.test(lineFirstToken))
|
|
37
|
-
|
|
38
|
-
if (silent)
|
|
39
|
-
return true;
|
|
36
|
+
if (!pattern.test(lineFirstToken)) return false;
|
|
37
|
+
if (silent) return true;
|
|
40
38
|
state.line = startLine + 1;
|
|
41
39
|
const tokenOpen = state.push("toc_open", containerTag, 1);
|
|
42
40
|
tokenOpen.markup = "";
|
package/dist/index.d.cts
CHANGED
|
@@ -85,7 +85,7 @@ interface TocPluginOptions {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type RenderHeadersFn = (headers: MarkdownItHeader[]) => string;
|
|
88
|
-
declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass, }: Pick<Required<TocPluginOptions>,
|
|
88
|
+
declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass, }: Pick<Required<TocPluginOptions>, "itemClass" | "linkClass" | "linkTag" | "listClass" | "listTag">) => RenderHeadersFn;
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Forked and modified from markdown-it-toc-done-right
|
|
@@ -95,7 +95,7 @@ declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, li
|
|
|
95
95
|
*
|
|
96
96
|
* @see https://github.com/nagaozen/markdown-it-toc-done-right
|
|
97
97
|
*/
|
|
98
|
-
declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: Pick<Required<TocPluginOptions>,
|
|
98
|
+
declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: Pick<Required<TocPluginOptions>, "containerClass" | "containerTag" | "pattern">) => RuleBlock;
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Generate table of contents
|
|
@@ -106,4 +106,5 @@ declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: P
|
|
|
106
106
|
*/
|
|
107
107
|
declare const tocPlugin: PluginWithOptions<TocPluginOptions>;
|
|
108
108
|
|
|
109
|
-
export {
|
|
109
|
+
export { createRenderHeaders, createTocBlockRule, tocPlugin };
|
|
110
|
+
export type { TocPluginOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -85,7 +85,7 @@ interface TocPluginOptions {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type RenderHeadersFn = (headers: MarkdownItHeader[]) => string;
|
|
88
|
-
declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass, }: Pick<Required<TocPluginOptions>,
|
|
88
|
+
declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass, }: Pick<Required<TocPluginOptions>, "itemClass" | "linkClass" | "linkTag" | "listClass" | "listTag">) => RenderHeadersFn;
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Forked and modified from markdown-it-toc-done-right
|
|
@@ -95,7 +95,7 @@ declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, li
|
|
|
95
95
|
*
|
|
96
96
|
* @see https://github.com/nagaozen/markdown-it-toc-done-right
|
|
97
97
|
*/
|
|
98
|
-
declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: Pick<Required<TocPluginOptions>,
|
|
98
|
+
declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: Pick<Required<TocPluginOptions>, "containerClass" | "containerTag" | "pattern">) => RuleBlock;
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Generate table of contents
|
|
@@ -106,4 +106,5 @@ declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: P
|
|
|
106
106
|
*/
|
|
107
107
|
declare const tocPlugin: PluginWithOptions<TocPluginOptions>;
|
|
108
108
|
|
|
109
|
-
export {
|
|
109
|
+
export { createRenderHeaders, createTocBlockRule, tocPlugin };
|
|
110
|
+
export type { TocPluginOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ interface TocPluginOptions {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type RenderHeadersFn = (headers: MarkdownItHeader[]) => string;
|
|
88
|
-
declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass, }: Pick<Required<TocPluginOptions>,
|
|
88
|
+
declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass, }: Pick<Required<TocPluginOptions>, "itemClass" | "linkClass" | "linkTag" | "listClass" | "listTag">) => RenderHeadersFn;
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Forked and modified from markdown-it-toc-done-right
|
|
@@ -95,7 +95,7 @@ declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, li
|
|
|
95
95
|
*
|
|
96
96
|
* @see https://github.com/nagaozen/markdown-it-toc-done-right
|
|
97
97
|
*/
|
|
98
|
-
declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: Pick<Required<TocPluginOptions>,
|
|
98
|
+
declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: Pick<Required<TocPluginOptions>, "containerClass" | "containerTag" | "pattern">) => RuleBlock;
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Generate table of contents
|
|
@@ -106,4 +106,5 @@ declare const createTocBlockRule: ({ pattern, containerTag, containerClass, }: P
|
|
|
106
106
|
*/
|
|
107
107
|
declare const tocPlugin: PluginWithOptions<TocPluginOptions>;
|
|
108
108
|
|
|
109
|
-
export {
|
|
109
|
+
export { createRenderHeaders, createTocBlockRule, tocPlugin };
|
|
110
|
+
export type { TocPluginOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -31,10 +31,8 @@ const createTocBlockRule = ({
|
|
|
31
31
|
const pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
32
32
|
const max = state.eMarks[startLine];
|
|
33
33
|
const lineFirstToken = state.src.slice(pos, max).split(" ")[0];
|
|
34
|
-
if (!pattern.test(lineFirstToken))
|
|
35
|
-
|
|
36
|
-
if (silent)
|
|
37
|
-
return true;
|
|
34
|
+
if (!pattern.test(lineFirstToken)) return false;
|
|
35
|
+
if (silent) return true;
|
|
38
36
|
state.line = startLine + 1;
|
|
39
37
|
const tokenOpen = state.push("toc_open", containerTag, 1);
|
|
40
38
|
tokenOpen.markup = "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdit-vue/plugin-toc",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A markdown-it plugin to generate table-of-contents that compatible with Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"test": "vitest"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@mdit-vue/shared": "2.1.
|
|
47
|
-
"@mdit-vue/types": "2.1.
|
|
48
|
-
"@types/markdown-it": "^14.1.
|
|
46
|
+
"@mdit-vue/shared": "2.1.4",
|
|
47
|
+
"@mdit-vue/types": "2.1.4",
|
|
48
|
+
"@types/markdown-it": "^14.1.2",
|
|
49
49
|
"markdown-it": "^14.1.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"markdown-it-anchor": "^
|
|
52
|
+
"markdown-it-anchor": "^9.2.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "01a6daa37fff48ea3992becfd4ba8c0f97a605ad"
|
|
58
58
|
}
|