@mdit-vue/plugin-title 2.1.4 → 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,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.js ADDED
@@ -0,0 +1,22 @@
1
+ import { resolveTitleFromToken } from "@mdit-vue/shared";
2
+
3
+ //#region src/title-plugin.ts
4
+ /**
5
+ * Get markdown page title info
6
+ *
7
+ * Extract it into env
8
+ */
9
+ const titlePlugin = (md) => {
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
+ };
19
+ };
20
+
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.4",
3
+ "version": "3.0.1",
4
4
  "description": "A markdown-it plugin to get markdown page title",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -20,39 +20,36 @@
20
20
  "author": "meteorlxy <meteor.lxy@foxmail.com>",
21
21
  "type": "module",
22
22
  "exports": {
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
- }
33
- },
34
- "main": "./dist/index.cjs",
35
- "module": "./dist/index.mjs",
23
+ ".": "./dist/index.js",
24
+ "./package.json": "./package.json"
25
+ },
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
36
28
  "types": "./dist/index.d.ts",
37
29
  "files": [
38
30
  "./dist"
39
31
  ],
40
32
  "scripts": {
41
- "build": "unbuild",
33
+ "build": "tsdown",
42
34
  "test": "vitest"
43
35
  },
44
36
  "dependencies": {
45
- "@mdit-vue/shared": "2.1.4",
46
- "@mdit-vue/types": "2.1.4",
37
+ "@mdit-vue/shared": "3.0.1",
38
+ "@mdit-vue/types": "3.0.1",
47
39
  "@types/markdown-it": "^14.1.2",
48
40
  "markdown-it": "^14.1.0"
49
41
  },
50
42
  "devDependencies": {
51
43
  "@types/markdown-it-emoji": "^3.0.1",
52
- "markdown-it-emoji": "^3.0.0"
44
+ "markdown-it-emoji": "^3.0.0",
45
+ "tsdown": "^0.14.0",
46
+ "vitest": "^3.2.4"
47
+ },
48
+ "engines": {
49
+ "node": ">=20.0.0"
53
50
  },
54
51
  "publishConfig": {
55
52
  "access": "public"
56
53
  },
57
- "gitHead": "01a6daa37fff48ea3992becfd4ba8c0f97a605ad"
54
+ "gitHead": "cdffe386ef7b897f1bf878ce20e38bdd07908fb1"
58
55
  }
package/dist/index.cjs DELETED
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- const shared = require('@mdit-vue/shared');
4
-
5
- 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
- };
15
- };
16
-
17
- exports.titlePlugin = titlePlugin;
package/dist/index.d.cts DELETED
@@ -1,19 +0,0 @@
1
- import { PluginSimple } from 'markdown-it';
2
-
3
- /**
4
- * Get markdown page title info
5
- *
6
- * Extract it into env
7
- */
8
- 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 };
package/dist/index.d.mts DELETED
@@ -1,19 +0,0 @@
1
- import { PluginSimple } from 'markdown-it';
2
-
3
- /**
4
- * Get markdown page title info
5
- *
6
- * Extract it into env
7
- */
8
- 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 };
package/dist/index.mjs DELETED
@@ -1,15 +0,0 @@
1
- import { resolveTitleFromToken } from '@mdit-vue/shared';
2
-
3
- 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
- };
13
- };
14
-
15
- export { titlePlugin };