@mdit-vue/plugin-title 2.1.3 → 3.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.cjs CHANGED
@@ -1,17 +1,45 @@
1
- 'use strict';
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));
2
22
 
3
- const shared = require('@mdit-vue/shared');
23
+ //#endregion
24
+ const __mdit_vue_shared = __toESM(require("@mdit-vue/shared"));
4
25
 
26
+ //#region src/title-plugin.ts
27
+ /**
28
+ * Get markdown page title info
29
+ *
30
+ * Extract it into env
31
+ */
5
32
  const titlePlugin = (md) => {
6
- const render = md.renderer.render.bind(md.renderer);
7
- md.renderer.render = (tokens, options, env) => {
8
- const tokenIdx = tokens.findIndex((token) => token.tag === "h1");
9
- env.title = tokenIdx > -1 ? shared.resolveTitleFromToken(tokens[tokenIdx + 1], {
10
- shouldAllowHtml: false,
11
- shouldEscapeText: false
12
- }) : "";
13
- return render(tokens, options, env);
14
- };
33
+ const render = md.renderer.render.bind(md.renderer);
34
+ md.renderer.render = (tokens, options, env) => {
35
+ const tokenIdx = tokens.findIndex((token) => token.tag === "h1");
36
+ env.title = tokenIdx > -1 ? (0, __mdit_vue_shared.resolveTitleFromToken)(tokens[tokenIdx + 1], {
37
+ shouldAllowHtml: false,
38
+ shouldEscapeText: false
39
+ }) : "";
40
+ return render(tokens, options, env);
41
+ };
15
42
  };
16
43
 
17
- exports.titlePlugin = titlePlugin;
44
+ //#endregion
45
+ exports.titlePlugin = titlePlugin;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,6 @@
1
- import { PluginSimple } from 'markdown-it';
1
+ import { PluginSimple } from "markdown-it";
2
+
3
+ //#region src/title-plugin.d.ts
2
4
 
3
5
  /**
4
6
  * Get markdown page title info
@@ -6,14 +8,5 @@ import { PluginSimple } from 'markdown-it';
6
8
  * Extract it into env
7
9
  */
8
10
  declare const titlePlugin: PluginSimple;
9
-
10
- declare module '@mdit-vue/types' {
11
- interface MarkdownItEnv {
12
- /**
13
- * The title that extracted by `@mdit-vue/plugin-title`
14
- */
15
- title?: string;
16
- }
17
- }
18
-
19
- export { titlePlugin };
11
+ //#endregion
12
+ export { titlePlugin };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
- import { PluginSimple } from 'markdown-it';
1
+ import { PluginSimple } from "markdown-it";
2
+
3
+ //#region src/title-plugin.d.ts
2
4
 
3
5
  /**
4
6
  * Get markdown page title info
@@ -6,14 +8,5 @@ import { PluginSimple } from 'markdown-it';
6
8
  * Extract it into env
7
9
  */
8
10
  declare const titlePlugin: PluginSimple;
9
-
10
- declare module '@mdit-vue/types' {
11
- interface MarkdownItEnv {
12
- /**
13
- * The title that extracted by `@mdit-vue/plugin-title`
14
- */
15
- title?: string;
16
- }
17
- }
18
-
19
- export { titlePlugin };
11
+ //#endregion
12
+ export { titlePlugin };
package/dist/index.mjs CHANGED
@@ -1,15 +1,22 @@
1
- import { resolveTitleFromToken } from '@mdit-vue/shared';
1
+ import { resolveTitleFromToken } from "@mdit-vue/shared";
2
2
 
3
+ //#region src/title-plugin.ts
4
+ /**
5
+ * Get markdown page title info
6
+ *
7
+ * Extract it into env
8
+ */
3
9
  const titlePlugin = (md) => {
4
- const render = md.renderer.render.bind(md.renderer);
5
- md.renderer.render = (tokens, options, env) => {
6
- const tokenIdx = tokens.findIndex((token) => token.tag === "h1");
7
- env.title = tokenIdx > -1 ? resolveTitleFromToken(tokens[tokenIdx + 1], {
8
- shouldAllowHtml: false,
9
- shouldEscapeText: false
10
- }) : "";
11
- return render(tokens, options, env);
12
- };
10
+ const render = md.renderer.render.bind(md.renderer);
11
+ md.renderer.render = (tokens, options, env) => {
12
+ const tokenIdx = tokens.findIndex((token) => token.tag === "h1");
13
+ env.title = tokenIdx > -1 ? resolveTitleFromToken(tokens[tokenIdx + 1], {
14
+ shouldAllowHtml: false,
15
+ shouldEscapeText: false
16
+ }) : "";
17
+ return render(tokens, options, env);
18
+ };
13
19
  };
14
20
 
15
- export { titlePlugin };
21
+ //#endregion
22
+ export { titlePlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdit-vue/plugin-title",
3
- "version": "2.1.3",
3
+ "version": "3.0.0",
4
4
  "description": "A markdown-it plugin to get markdown page title",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -21,38 +21,38 @@
21
21
  "type": "module",
22
22
  "exports": {
23
23
  ".": {
24
- "import": {
25
- "types": "./dist/index.d.mts",
26
- "default": "./dist/index.mjs"
27
- },
28
- "require": {
29
- "types": "./dist/index.d.cts",
30
- "default": "./dist/index.cjs"
31
- }
32
- }
24
+ "import": "./dist/index.mjs",
25
+ "require": "./dist/index.cjs"
26
+ },
27
+ "./package.json": "./package.json"
33
28
  },
34
29
  "main": "./dist/index.cjs",
35
30
  "module": "./dist/index.mjs",
36
- "types": "./dist/index.d.ts",
31
+ "types": "./dist/index.d.cts",
37
32
  "files": [
38
33
  "./dist"
39
34
  ],
40
35
  "scripts": {
41
- "build": "unbuild",
36
+ "build": "tsdown",
42
37
  "test": "vitest"
43
38
  },
44
39
  "dependencies": {
45
- "@mdit-vue/shared": "2.1.3",
46
- "@mdit-vue/types": "2.1.0",
47
- "@types/markdown-it": "^14.1.1",
40
+ "@mdit-vue/shared": "3.0.0",
41
+ "@mdit-vue/types": "3.0.0",
42
+ "@types/markdown-it": "^14.1.2",
48
43
  "markdown-it": "^14.1.0"
49
44
  },
50
45
  "devDependencies": {
51
46
  "@types/markdown-it-emoji": "^3.0.1",
52
- "markdown-it-emoji": "^3.0.0"
47
+ "markdown-it-emoji": "^3.0.0",
48
+ "tsdown": "^0.14.0",
49
+ "vitest": "^3.2.4"
50
+ },
51
+ "engines": {
52
+ "node": ">=20.0.0"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "0b0ff6922bba2627dad6b9cf0e4249f0a9ecbe15"
57
+ "gitHead": "bbb62a47109c2932505b3f570b963f70d590914f"
58
58
  }