@altano/remark-mdx-toc-with-slugs 2.0.1 → 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/README.md +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -4
- package/package.json +41 -33
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Summary
|
|
4
4
|
|
|
5
|
-
This is a [remark](https://remark.js.org/) plugin that exports a table of contents. It is similar to the [remark-mdx-toc](https://
|
|
5
|
+
This is a [remark](https://remark.js.org/) plugin that exports a table of contents. It is similar to the [@altano/remark-mdx-toc](https://www.npmjs.com/package/@altano/remark-mdx-toc) plugin but has an additional `slug` property.
|
|
6
6
|
|
|
7
7
|
Given this mdx:
|
|
8
8
|
|
|
@@ -58,5 +58,5 @@ export const toc = [
|
|
|
58
58
|
|
|
59
59
|
## Misc
|
|
60
60
|
|
|
61
|
-
- If you don't need the slug, consider using [remark-mdx-toc](https://
|
|
61
|
+
- If you don't need the slug, consider using [@altano/remark-mdx-toc](https://www.npmjs.com/package/@altano/remark-mdx-toc).
|
|
62
62
|
- Slugs are generated using [`github-slugger`](https://www.npmjs.com/package/github-slugger) and should therefore match the [`rehype-slug`](https://www.npmjs.com/package/rehype-slug) package
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { generate } from "astring";
|
|
|
2
2
|
import { valueToEstree } from "estree-util-value-to-estree";
|
|
3
3
|
import { EXIT, visit as estreeVisit } from "estree-util-visit";
|
|
4
4
|
import GithubSlugger from "github-slugger";
|
|
5
|
-
import
|
|
5
|
+
import remarkMdxToc from "@altano/remark-mdx-toc";
|
|
6
6
|
import { visit } from "unist-util-visit";
|
|
7
7
|
function sluggifyTocEntries(entries, headingSlugger = new GithubSlugger()) {
|
|
8
8
|
return entries.map((entry) => sluggifyTocEntry(entry, headingSlugger));
|
|
@@ -21,9 +21,6 @@ function assertMdxjsEsmNode(node) {
|
|
|
21
21
|
}
|
|
22
22
|
const remarkMdxTocWithSlugs = function(options = {}) {
|
|
23
23
|
const mdxTocTransformer = remarkMdxToc.call(this, options);
|
|
24
|
-
if (mdxTocTransformer == null) {
|
|
25
|
-
throw new Error(`Couldn't create mdxTocTransformer function`);
|
|
26
|
-
}
|
|
27
24
|
const name = options.name ?? "toc";
|
|
28
25
|
return function mdxTocWithSlugsTransformer(ast, ...args) {
|
|
29
26
|
const result = mdxTocTransformer(ast, ...args);
|
package/package.json
CHANGED
|
@@ -1,53 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/remark-mdx-toc-with-slugs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A remark plugin to generate a table of contents (including slugs) and convert it into MDX export",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"license": "ISC",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mdx",
|
|
7
|
+
"remark",
|
|
8
|
+
"toc",
|
|
9
|
+
"slug",
|
|
10
|
+
"remark-plugin"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/altano/npm-packages/tree/main/packages/remark-mdx-toc-with-slugs",
|
|
15
13
|
"repository": {
|
|
16
14
|
"type": "git",
|
|
17
15
|
"url": "https://github.com/altano/npm-packages",
|
|
18
16
|
"directory": "packages/remark-mdx-toc-with-slugs"
|
|
19
17
|
},
|
|
20
|
-
"
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Alan Norbauer",
|
|
21
|
+
"email": "altano@gmail.com",
|
|
22
|
+
"url": "https://alan.norbauer.com"
|
|
23
|
+
},
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
21
28
|
"files": [
|
|
22
29
|
"dist/**/*.js",
|
|
23
30
|
"dist/**/*.d.ts"
|
|
24
31
|
],
|
|
25
|
-
"keywords": [
|
|
26
|
-
"remark",
|
|
27
|
-
"remark-plugin",
|
|
28
|
-
"mdx"
|
|
29
|
-
],
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"astring": "^1.
|
|
32
|
-
"estree-util-value-to-estree": "^3.
|
|
33
|
+
"astring": "^1.9.0",
|
|
34
|
+
"estree-util-value-to-estree": "^3.1.2",
|
|
33
35
|
"estree-util-visit": "^2.0.0",
|
|
34
36
|
"github-slugger": "^2.0.0",
|
|
35
37
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
38
|
+
"unified": "^11.0.5",
|
|
39
|
+
"unist-util-visit": "^5.0.0",
|
|
40
|
+
"@altano/remark-mdx-toc": "0.0.2"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@
|
|
43
|
+
"@arethetypeswrong/cli": "^0.15.4",
|
|
44
|
+
"@types/node": "^22.13.10",
|
|
42
45
|
"@types/unist": "^3.0.2",
|
|
43
|
-
"@vitest/coverage-v8": "^
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"@vitest/coverage-v8": "^3.0.9",
|
|
47
|
+
"depcheck": "^1.4.7",
|
|
48
|
+
"prettier": "^3.3.3",
|
|
49
|
+
"typescript": "^5.8.2",
|
|
50
|
+
"vite": "^6.2.3",
|
|
51
|
+
"vitest": "^3.0.9",
|
|
52
|
+
"@altano/build-config": "0.0.0",
|
|
48
53
|
"@altano/remark-plugin-test-util": "0.0.0",
|
|
54
|
+
"@altano/testing": "0.0.0",
|
|
49
55
|
"@altano/tsconfig": "0.0.0",
|
|
50
|
-
"@altano/vitest-plugins": "0.
|
|
56
|
+
"@altano/vitest-plugins": "1.0.0"
|
|
51
57
|
},
|
|
52
58
|
"publishConfig": {
|
|
53
59
|
"access": "public"
|
|
@@ -55,16 +61,18 @@
|
|
|
55
61
|
"scripts": {
|
|
56
62
|
"build": "tsup --config build-config/tsup.config.node.ts",
|
|
57
63
|
"build:types": "tsc --project tsconfig.declarations.json",
|
|
64
|
+
"check:exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
|
|
65
|
+
"check:types:src": "tsc --noEmit",
|
|
66
|
+
"check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
|
|
67
|
+
"check:unused-dependencies": "depcheck",
|
|
58
68
|
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
59
69
|
"dev": "pnpm run build --watch",
|
|
60
70
|
"format": "prettier --check src",
|
|
61
71
|
"format:fix": "prettier --write src",
|
|
62
|
-
"lint": "eslint
|
|
72
|
+
"lint": "eslint",
|
|
63
73
|
"lint:fix": "TIMING=1 pnpm lint --fix",
|
|
64
74
|
"lint:timing": "TIMING=1 pnpm lint",
|
|
65
75
|
"test:unit": "vitest --run",
|
|
66
|
-
"test:unit:watch": "vitest"
|
|
67
|
-
"typecheck:src": "tsc --noEmit",
|
|
68
|
-
"typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
|
|
76
|
+
"test:unit:watch": "vitest"
|
|
69
77
|
}
|
|
70
78
|
}
|