@mdit-vue/plugin-toc 3.0.2 → 4.0.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.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,4 @@
1
- import { MarkdownItHeader } from "@mdit-vue/types";
2
- import { RuleBlock } from "markdown-it/lib/parser_block.mjs";
3
- import { PluginWithOptions } from "markdown-it";
4
-
5
- //#region src/types.d.ts
1
+ import { MarkdownItBlockRule, MarkdownItHeader, MarkdownItPlugin } from "@mdit-vue/types";
6
2
  /**
7
3
  * Options of @mdit-vue/plugin-toc
8
4
  */
@@ -84,18 +80,8 @@ interface TocPluginOptions {
84
80
  */
85
81
  linkClass?: string;
86
82
  }
87
- //#endregion
88
- //#region src/create-render-headers.d.ts
89
83
  type RenderHeadersFn = (headers: MarkdownItHeader[]) => string;
90
- declare const createRenderHeaders: ({
91
- listTag,
92
- listClass,
93
- itemClass,
94
- linkTag,
95
- linkClass
96
- }: Pick<Required<TocPluginOptions>, "itemClass" | "linkClass" | "linkTag" | "listClass" | "listTag">) => RenderHeadersFn;
97
- //#endregion
98
- //#region src/create-toc-block-rule.d.ts
84
+ export declare const createRenderHeaders: ({ listTag, listClass, itemClass, linkTag, linkClass }: Pick<Required<TocPluginOptions>, "itemClass" | "linkClass" | "linkTag" | "listClass" | "listTag">) => RenderHeadersFn;
99
85
  /**
100
86
  * Forked and modified from markdown-it-toc-done-right
101
87
  *
@@ -104,13 +90,7 @@ declare const createRenderHeaders: ({
104
90
  *
105
91
  * @see https://github.com/nagaozen/markdown-it-toc-done-right
106
92
  */
107
- declare const createTocBlockRule: ({
108
- pattern,
109
- containerTag,
110
- containerClass
111
- }: Pick<Required<TocPluginOptions>, "containerClass" | "containerTag" | "pattern">) => RuleBlock;
112
- //#endregion
113
- //#region src/toc-plugin.d.ts
93
+ export declare const createTocBlockRule: ({ pattern, containerTag, containerClass }: Pick<Required<TocPluginOptions>, "containerClass" | "containerTag" | "pattern">) => MarkdownItBlockRule;
114
94
  /**
115
95
  * Generate table of contents
116
96
  *
@@ -118,6 +98,5 @@ declare const createTocBlockRule: ({
118
98
  *
119
99
  * @see https://github.com/nagaozen/markdown-it-toc-done-right
120
100
  */
121
- declare const tocPlugin: PluginWithOptions<TocPluginOptions>;
122
- //#endregion
123
- export { TocPluginOptions, createRenderHeaders, createTocBlockRule, tocPlugin };
101
+ export declare const tocPlugin: MarkdownItPlugin<TocPluginOptions>;
102
+ export type { TocPluginOptions };
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { htmlEscape, resolveHeadersFromTokens, slugify } from "@mdit-vue/shared";
2
-
3
- //#region src/create-render-headers.ts
2
+ // src/create-render-headers.ts
4
3
  const createRenderHeaders = ({ listTag, listClass, itemClass, linkTag, linkClass }) => {
5
4
  const listTagString = htmlEscape(listTag);
6
5
  const listClassString = listClass ? ` class="${htmlEscape(listClass)}"` : "";
@@ -22,9 +21,7 @@ ${header.children.length > 0 ? renderHeaders(header.children) : ""}\
22
21
  </${listTagString}>`;
23
22
  return renderHeaders;
24
23
  };
25
-
26
- //#endregion
27
- //#region src/create-toc-block-rule.ts
24
+ // src/create-toc-block-rule.ts
28
25
  /**
29
26
  * Forked and modified from markdown-it-toc-done-right
30
27
  *
@@ -54,9 +51,7 @@ const createTocBlockRule = ({ pattern, containerTag, containerClass }) => (state
54
51
  tokenBody.map = [startLine, state.line];
55
52
  return true;
56
53
  };
57
-
58
- //#endregion
59
- //#region src/toc-plugin.ts
54
+ // src/toc-plugin.ts
60
55
  /**
61
56
  * Generate table of contents
62
57
  *
@@ -90,6 +85,4 @@ const tocPlugin = (md, { pattern = /^\[\[toc\]\]$/i, slugify: slugify$1 = slugif
90
85
  format
91
86
  }));
92
87
  };
93
-
94
- //#endregion
95
- export { createRenderHeaders, createTocBlockRule, tocPlugin };
88
+ export { createRenderHeaders, createTocBlockRule, tocPlugin };
package/package.json CHANGED
@@ -1,56 +1,53 @@
1
1
  {
2
2
  "name": "@mdit-vue/plugin-toc",
3
- "version": "3.0.2",
3
+ "version": "4.0.0",
4
4
  "description": "A markdown-it plugin to generate table-of-contents that compatible with Vue.js",
5
5
  "keywords": [
6
6
  "markdown-it",
7
7
  "markdown-it-plugin",
8
- "vue",
8
+ "table-of-contents",
9
9
  "toc",
10
- "table-of-contents"
10
+ "vue"
11
11
  ],
12
12
  "homepage": "https://github.com/mdit-vue",
13
13
  "bugs": {
14
14
  "url": "https://github.com/mdit-vue/mdit-vue/issues"
15
15
  },
16
+ "license": "MIT",
17
+ "author": "meteorlxy <meteor.lxy@foxmail.com>",
16
18
  "repository": {
17
19
  "type": "git",
18
20
  "url": "git+https://github.com/mdit-vue/mdit-vue.git"
19
21
  },
20
- "license": "MIT",
21
- "author": "meteorlxy <meteor.lxy@foxmail.com>",
22
+ "files": [
23
+ "./dist"
24
+ ],
22
25
  "type": "module",
26
+ "types": "./dist/index.d.ts",
23
27
  "exports": {
24
28
  ".": "./dist/index.js",
25
29
  "./package.json": "./package.json"
26
30
  },
27
- "main": "./dist/index.js",
28
- "module": "./dist/index.js",
29
- "types": "./dist/index.d.ts",
30
- "files": [
31
- "./dist"
32
- ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
33
34
  "scripts": {
34
35
  "build": "tsdown",
35
36
  "clean": "rimraf ./dist",
36
37
  "test": "vitest"
37
38
  },
38
39
  "dependencies": {
39
- "@mdit-vue/shared": "3.0.2",
40
- "@mdit-vue/types": "3.0.2",
41
- "@types/markdown-it": "^14.1.2",
42
- "markdown-it": "^14.1.0"
40
+ "@mdit-vue/shared": "4.0.0",
41
+ "@mdit-vue/types": "4.0.0",
42
+ "markdown-it": "^15.0.3"
43
43
  },
44
44
  "devDependencies": {
45
- "markdown-it-anchor": "^9.2.0",
46
- "tsdown": "^0.14.1",
47
- "vitest": "^3.2.4"
45
+ "markdown-it-anchor": "^10.1.0",
46
+ "tsdown": "^0.23.7",
47
+ "vitest": "^5.1.0"
48
48
  },
49
49
  "engines": {
50
- "node": ">=20.0.0"
51
- },
52
- "publishConfig": {
53
- "access": "public"
50
+ "node": ">=20.19.0"
54
51
  },
55
- "gitHead": "3b5332d09fbd927319bd8be3ba3b86b3d12d1ec8"
52
+ "gitHead": "62f17856a1a5dec0e33c6487453a927b82a5883b"
56
53
  }