@mdit-vue/plugin-headers 3.0.0 → 3.0.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.ts CHANGED
@@ -1,55 +1,56 @@
1
- import { PluginWithOptions } from 'markdown-it';
2
- import { MarkdownItHeader } from '@mdit-vue/types';
3
- export { MarkdownItHeader } from '@mdit-vue/types';
1
+ import { PluginWithOptions } from "markdown-it";
2
+ import { MarkdownItHeader } from "@mdit-vue/types";
3
+
4
+ //#region src/types.d.ts
4
5
 
5
6
  /**
6
7
  * Options of @mdit-vue/plugin-headers
7
8
  */
8
9
  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;
10
+ /**
11
+ * A custom slugification function
12
+ *
13
+ * Should use the same slugify function with markdown-it-anchor
14
+ * to ensure the link is matched
15
+ */
16
+ slugify?: (str: string) => string;
17
+ /**
18
+ * A function for formatting header title
19
+ */
20
+ format?: (str: string) => string;
21
+ /**
22
+ * Heading level that going to be extracted
23
+ *
24
+ * Should be a subset of markdown-it-anchor's `level` option
25
+ * to ensure the slug is existed
26
+ *
27
+ * @default [2,3]
28
+ */
29
+ level?: number[];
30
+ /**
31
+ * Should allow headers inside nested blocks or not
32
+ *
33
+ * If set to `true`, headers inside blockquote, list, etc. would also be extracted.
34
+ *
35
+ * @default false
36
+ */
37
+ shouldAllowNested?: boolean;
37
38
  }
38
39
  declare module '@mdit-vue/types' {
39
- interface MarkdownItEnv {
40
- /**
41
- * The headers that extracted by `@mdit-vue/plugin-headers`
42
- */
43
- headers?: MarkdownItHeader[];
44
- }
40
+ interface MarkdownItEnv {
41
+ /**
42
+ * The headers that extracted by `@mdit-vue/plugin-headers`
43
+ */
44
+ headers?: MarkdownItHeader[];
45
+ }
45
46
  }
46
-
47
+ //#endregion
48
+ //#region src/headers-plugin.d.ts
47
49
  /**
48
50
  * Get markdown headers info
49
51
  *
50
52
  * Extract them into env
51
53
  */
52
54
  declare const headersPlugin: PluginWithOptions<HeadersPluginOptions>;
53
-
54
- export { headersPlugin };
55
- export type { HeadersPluginOptions };
55
+ //#endregion
56
+ export { HeadersPluginOptions, type MarkdownItHeader, headersPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdit-vue/plugin-headers",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A markdown-it plugin to get markdown headers",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -21,15 +21,12 @@
21
21
  "author": "meteorlxy <meteor.lxy@foxmail.com>",
22
22
  "type": "module",
23
23
  "exports": {
24
- ".": {
25
- "import": "./dist/index.mjs",
26
- "require": "./dist/index.cjs"
27
- },
24
+ ".": "./dist/index.js",
28
25
  "./package.json": "./package.json"
29
26
  },
30
- "main": "./dist/index.cjs",
31
- "module": "./dist/index.mjs",
32
- "types": "./dist/index.d.cts",
27
+ "main": "./dist/index.js",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
33
30
  "files": [
34
31
  "./dist"
35
32
  ],
@@ -38,8 +35,8 @@
38
35
  "test": "vitest"
39
36
  },
40
37
  "dependencies": {
41
- "@mdit-vue/shared": "3.0.0",
42
- "@mdit-vue/types": "3.0.0",
38
+ "@mdit-vue/shared": "3.0.1",
39
+ "@mdit-vue/types": "3.0.1",
43
40
  "@types/markdown-it": "^14.1.2",
44
41
  "markdown-it": "^14.1.0"
45
42
  },
@@ -54,5 +51,5 @@
54
51
  "publishConfig": {
55
52
  "access": "public"
56
53
  },
57
- "gitHead": "bbb62a47109c2932505b3f570b963f70d590914f"
54
+ "gitHead": "cdffe386ef7b897f1bf878ce20e38bdd07908fb1"
58
55
  }
package/dist/index.cjs DELETED
@@ -1,48 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- const __mdit_vue_shared = __toESM(require("@mdit-vue/shared"));
25
-
26
- //#region src/headers-plugin.ts
27
- /**
28
- * Get markdown headers info
29
- *
30
- * Extract them into env
31
- */
32
- const headersPlugin = (md, { level = [2, 3], shouldAllowNested = false, slugify = __mdit_vue_shared.slugify, format } = {}) => {
33
- const render = md.renderer.render.bind(md.renderer);
34
- md.renderer.render = (tokens, options, env) => {
35
- env.headers = (0, __mdit_vue_shared.resolveHeadersFromTokens)(tokens, {
36
- level,
37
- shouldAllowHtml: false,
38
- shouldAllowNested,
39
- shouldEscapeText: false,
40
- slugify,
41
- format
42
- });
43
- return render(tokens, options, env);
44
- };
45
- };
46
-
47
- //#endregion
48
- exports.headersPlugin = headersPlugin;
package/dist/index.d.cts DELETED
@@ -1,56 +0,0 @@
1
- import { PluginWithOptions } from "markdown-it";
2
- import { MarkdownItHeader } from "@mdit-vue/types";
3
-
4
- //#region src/types.d.ts
5
-
6
- /**
7
- * Options of @mdit-vue/plugin-headers
8
- */
9
- interface HeadersPluginOptions {
10
- /**
11
- * A custom slugification function
12
- *
13
- * Should use the same slugify function with markdown-it-anchor
14
- * to ensure the link is matched
15
- */
16
- slugify?: (str: string) => string;
17
- /**
18
- * A function for formatting header title
19
- */
20
- format?: (str: string) => string;
21
- /**
22
- * Heading level that going to be extracted
23
- *
24
- * Should be a subset of markdown-it-anchor's `level` option
25
- * to ensure the slug is existed
26
- *
27
- * @default [2,3]
28
- */
29
- level?: number[];
30
- /**
31
- * Should allow headers inside nested blocks or not
32
- *
33
- * If set to `true`, headers inside blockquote, list, etc. would also be extracted.
34
- *
35
- * @default false
36
- */
37
- shouldAllowNested?: boolean;
38
- }
39
- declare module '@mdit-vue/types' {
40
- interface MarkdownItEnv {
41
- /**
42
- * The headers that extracted by `@mdit-vue/plugin-headers`
43
- */
44
- headers?: MarkdownItHeader[];
45
- }
46
- }
47
- //#endregion
48
- //#region src/headers-plugin.d.ts
49
- /**
50
- * Get markdown headers info
51
- *
52
- * Extract them into env
53
- */
54
- declare const headersPlugin: PluginWithOptions<HeadersPluginOptions>;
55
- //#endregion
56
- export { HeadersPluginOptions, type MarkdownItHeader, headersPlugin };
package/dist/index.d.mts DELETED
@@ -1,56 +0,0 @@
1
- import { PluginWithOptions } from "markdown-it";
2
- import { MarkdownItHeader } from "@mdit-vue/types";
3
-
4
- //#region src/types.d.ts
5
-
6
- /**
7
- * Options of @mdit-vue/plugin-headers
8
- */
9
- interface HeadersPluginOptions {
10
- /**
11
- * A custom slugification function
12
- *
13
- * Should use the same slugify function with markdown-it-anchor
14
- * to ensure the link is matched
15
- */
16
- slugify?: (str: string) => string;
17
- /**
18
- * A function for formatting header title
19
- */
20
- format?: (str: string) => string;
21
- /**
22
- * Heading level that going to be extracted
23
- *
24
- * Should be a subset of markdown-it-anchor's `level` option
25
- * to ensure the slug is existed
26
- *
27
- * @default [2,3]
28
- */
29
- level?: number[];
30
- /**
31
- * Should allow headers inside nested blocks or not
32
- *
33
- * If set to `true`, headers inside blockquote, list, etc. would also be extracted.
34
- *
35
- * @default false
36
- */
37
- shouldAllowNested?: boolean;
38
- }
39
- declare module '@mdit-vue/types' {
40
- interface MarkdownItEnv {
41
- /**
42
- * The headers that extracted by `@mdit-vue/plugin-headers`
43
- */
44
- headers?: MarkdownItHeader[];
45
- }
46
- }
47
- //#endregion
48
- //#region src/headers-plugin.d.ts
49
- /**
50
- * Get markdown headers info
51
- *
52
- * Extract them into env
53
- */
54
- declare const headersPlugin: PluginWithOptions<HeadersPluginOptions>;
55
- //#endregion
56
- export { HeadersPluginOptions, type MarkdownItHeader, headersPlugin };
File without changes