@altano/remark-mdx-toc-with-slugs 1.0.3 → 2.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 +6 -7
- package/dist/index.js +1 -2
- package/package.json +34 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plugin } from
|
|
3
|
-
|
|
4
|
-
declare type TableOfContentsEntry = TocEntry & {
|
|
1
|
+
import type { RemarkMdxTocOptions, TocEntry } from "remark-mdx-toc";
|
|
2
|
+
import type { Plugin } from "unified";
|
|
3
|
+
export type TableOfContentsEntry = TocEntry & {
|
|
5
4
|
slug: string;
|
|
6
5
|
children: TableOfContentsEntry[];
|
|
7
6
|
};
|
|
8
|
-
|
|
7
|
+
export type RemarkMdxTocWithSlugsOptions = RemarkMdxTocOptions;
|
|
9
8
|
/**
|
|
10
9
|
* Remark plugin that, given a tree that has had remark-mdx-toc run over it
|
|
11
10
|
* already, the toc data will be enhanced to have auto-generated slugs for every
|
|
12
11
|
* heading. This uses github-slugger
|
|
13
12
|
*/
|
|
14
13
|
declare const remarkMdxTocWithSlugs: Plugin<[RemarkMdxTocWithSlugsOptions?]>;
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export default remarkMdxTocWithSlugs;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
1
|
import { generate } from "astring";
|
|
3
2
|
import { valueToEstree } from "estree-util-value-to-estree";
|
|
4
3
|
import { EXIT, visit as estreeVisit } from "estree-util-visit";
|
|
@@ -20,7 +19,7 @@ function assertMdxjsEsmNode(node) {
|
|
|
20
19
|
throw new Error(`Node was unexpected type: ${node.type}`);
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
|
|
22
|
+
const remarkMdxTocWithSlugs = function(options = {}) {
|
|
24
23
|
const mdxTocTransformer = remarkMdxToc.call(this, options);
|
|
25
24
|
if (mdxTocTransformer == null) {
|
|
26
25
|
throw new Error(`Couldn't create mdxTocTransformer function`);
|
package/package.json
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/remark-mdx-toc-with-slugs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A remark plugin to generate a table of contents (including slugs) and convert it into MDX export",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsup src/index.ts --format esm --dts",
|
|
11
|
-
"dev": "tsup src/index.ts --watch --format esm --dts",
|
|
12
|
-
"lint": "TIMING=1 eslint src/**/*.ts* --fix",
|
|
13
|
-
"format": "prettier --write src",
|
|
14
|
-
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
15
|
-
"test": "vitest --run",
|
|
16
|
-
"test:watch": "vitest"
|
|
17
|
-
},
|
|
18
9
|
"author": {
|
|
19
10
|
"name": "Alan Norbauer",
|
|
20
11
|
"email": "altano@gmail.com",
|
|
21
12
|
"url": "https://alan.norbauer.com"
|
|
22
13
|
},
|
|
23
|
-
"license": "
|
|
14
|
+
"license": "ISC",
|
|
24
15
|
"repository": {
|
|
25
16
|
"type": "git",
|
|
26
17
|
"url": "https://github.com/altano/npm-packages",
|
|
@@ -28,7 +19,8 @@
|
|
|
28
19
|
},
|
|
29
20
|
"homepage": "https://github.com/altano/npm-packages/tree/main/packages/remark-mdx-toc-with-slugs",
|
|
30
21
|
"files": [
|
|
31
|
-
"dist"
|
|
22
|
+
"dist/**/*.js",
|
|
23
|
+
"dist/**/*.d.ts"
|
|
32
24
|
],
|
|
33
25
|
"keywords": [
|
|
34
26
|
"remark",
|
|
@@ -38,19 +30,41 @@
|
|
|
38
30
|
"dependencies": {
|
|
39
31
|
"astring": "^1.8.6",
|
|
40
32
|
"estree-util-value-to-estree": "^3.0.1",
|
|
41
|
-
"estree-util-visit": "^
|
|
33
|
+
"estree-util-visit": "^2.0.0",
|
|
42
34
|
"github-slugger": "^2.0.0",
|
|
43
|
-
"mdast-util-mdxjs-esm": "^
|
|
35
|
+
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
44
36
|
"remark-mdx-toc": "^0.3.1",
|
|
45
|
-
"
|
|
37
|
+
"unified": "^10.1.2",
|
|
38
|
+
"unist-util-visit": "^5.0.0"
|
|
46
39
|
},
|
|
47
40
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"
|
|
41
|
+
"@types/node": "^20.11.25",
|
|
42
|
+
"@types/unist": "^3.0.2",
|
|
43
|
+
"@vitest/coverage-v8": "^1.4.0",
|
|
44
|
+
"prettier": "^3.2.5",
|
|
45
|
+
"typescript": "^5.4.2",
|
|
46
|
+
"vite": "^5.2.4",
|
|
47
|
+
"vitest": "^1.4.0",
|
|
48
|
+
"@altano/remark-plugin-test-util": "0.0.0",
|
|
49
|
+
"@altano/tsconfig": "0.0.0",
|
|
50
|
+
"@altano/vitest-plugins": "0.0.2"
|
|
52
51
|
},
|
|
53
52
|
"publishConfig": {
|
|
54
53
|
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup --config build-config/tsup.config.node.ts",
|
|
57
|
+
"build:types": "tsc --project tsconfig.declarations.json",
|
|
58
|
+
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
59
|
+
"dev": "pnpm run build --watch",
|
|
60
|
+
"format": "prettier --check src",
|
|
61
|
+
"format:fix": "prettier --write src",
|
|
62
|
+
"lint": "eslint package.json src/**/*.ts*",
|
|
63
|
+
"lint:fix": "TIMING=1 pnpm lint --fix",
|
|
64
|
+
"lint:timing": "TIMING=1 pnpm lint",
|
|
65
|
+
"test:unit": "vitest --run",
|
|
66
|
+
"test:unit:watch": "vitest",
|
|
67
|
+
"typecheck:src": "tsc --noEmit",
|
|
68
|
+
"typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
|
|
55
69
|
}
|
|
56
|
-
}
|
|
70
|
+
}
|