cudoc-docusaurus 0.2.0 → 0.4.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/package.json +18 -15
- package/dist/heading-ids.d.ts +0 -21
- package/dist/heading-ids.d.ts.map +0 -1
- package/dist/heading-ids.js +0 -30
- package/dist/heading-ids.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cudoc-docusaurus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Docusaurus adapter for cudoc: remark wiring, default components and a theme that provides them.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/cudoment/cudoc.git",
|
|
9
|
+
"directory": "packages/cudoc-docusaurus"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/cudoment/cudoc/tree/main/packages/cudoc-docusaurus#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/cudoment/cudoc/issues"
|
|
14
|
+
},
|
|
5
15
|
"keywords": [
|
|
6
16
|
"cudoc",
|
|
7
17
|
"docusaurus",
|
|
@@ -9,17 +19,6 @@
|
|
|
9
19
|
"mdx",
|
|
10
20
|
"documentation"
|
|
11
21
|
],
|
|
12
|
-
"homepage": "https://github.com/cudoment/cudoc/tree/main/packages/cudoc-docusaurus#readme",
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/cudoment/cudoc/issues"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/cudoment/cudoc.git",
|
|
19
|
-
"directory": "packages/cudoc-docusaurus"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"author": "cudoment",
|
|
23
22
|
"type": "module",
|
|
24
23
|
"main": "./dist/index.js",
|
|
25
24
|
"types": "./dist/index.d.ts",
|
|
@@ -36,19 +35,23 @@
|
|
|
36
35
|
"README.md",
|
|
37
36
|
"LICENSE"
|
|
38
37
|
],
|
|
39
|
-
"
|
|
40
|
-
"
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
41
40
|
},
|
|
42
41
|
"scripts": {
|
|
43
42
|
"build": "tsc --build",
|
|
44
43
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"cudoc-remark": "0.
|
|
46
|
+
"cudoc-remark": "0.4.0",
|
|
48
47
|
"unified": "^11.0.5"
|
|
49
48
|
},
|
|
50
49
|
"peerDependencies": {
|
|
51
50
|
"@docusaurus/core": "^3.0.0",
|
|
52
51
|
"react": "^18.0.0 || ^19.0.0"
|
|
52
|
+
},
|
|
53
|
+
"author": "cudoment",
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=20"
|
|
53
56
|
}
|
|
54
57
|
}
|
package/dist/heading-ids.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copies the id from a cudoc anchor onto the heading itself.
|
|
3
|
-
*
|
|
4
|
-
* Docusaurus generates a heading id by slugifying the heading text, and builds
|
|
5
|
-
* its table of contents from those ids. Left alone it would produce a second id
|
|
6
|
-
* next to cudoc's anchor, and a deep link would resolve to whichever the
|
|
7
|
-
* browser found first. Its heading plugin honours an id that is already on
|
|
8
|
-
* `data.hProperties`, so writing the anchor id there makes the heading, the
|
|
9
|
-
* table of contents and the anchor agree on one value.
|
|
10
|
-
*/
|
|
11
|
-
import type { Root } from "mdast";
|
|
12
|
-
import type { Plugin } from "unified";
|
|
13
|
-
export type PromoteAnchorIdsOptions = {
|
|
14
|
-
/** Element name the id is read from. Matches `headingMetadata.anchor.name`. */
|
|
15
|
-
anchorName?: string;
|
|
16
|
-
/** Attribute the id is read from. Matches `headingMetadata.anchor.idAttribute`. */
|
|
17
|
-
idAttribute?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const promoteAnchorIds: Plugin<[PromoteAnchorIdsOptions?], Root>;
|
|
20
|
-
export default promoteAnchorIds;
|
|
21
|
-
//# sourceMappingURL=heading-ids.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heading-ids.d.ts","sourceRoot":"","sources":["../src/heading-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAQrC,MAAM,MAAM,uBAAuB,GAAG;IACpC,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAOD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,IAAI,CAoBrE,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
package/dist/heading-ids.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copies the id from a cudoc anchor onto the heading itself.
|
|
3
|
-
*
|
|
4
|
-
* Docusaurus generates a heading id by slugifying the heading text, and builds
|
|
5
|
-
* its table of contents from those ids. Left alone it would produce a second id
|
|
6
|
-
* next to cudoc's anchor, and a deep link would resolve to whichever the
|
|
7
|
-
* browser found first. Its heading plugin honours an id that is already on
|
|
8
|
-
* `data.hProperties`, so writing the anchor id there makes the heading, the
|
|
9
|
-
* table of contents and the anchor agree on one value.
|
|
10
|
-
*/
|
|
11
|
-
import { visit } from "unist-util-visit";
|
|
12
|
-
import { extractAnchorId, findAnchorNode, DEFAULT_ANCHOR_NAME, } from "cudoc-core";
|
|
13
|
-
export const promoteAnchorIds = (options = {}) => {
|
|
14
|
-
const anchorName = options.anchorName ?? DEFAULT_ANCHOR_NAME;
|
|
15
|
-
const idAttribute = options.idAttribute ?? "id";
|
|
16
|
-
return (tree) => {
|
|
17
|
-
visit(tree, "heading", (heading) => {
|
|
18
|
-
const id = extractAnchorId(findAnchorNode(heading.children, anchorName), idAttribute);
|
|
19
|
-
if (!id)
|
|
20
|
-
return;
|
|
21
|
-
const data = (heading.data ?? (heading.data = {}));
|
|
22
|
-
const properties = data.hProperties ?? (data.hProperties = {});
|
|
23
|
-
// An id the author put there another way wins: this only fills a gap.
|
|
24
|
-
if (properties.id === undefined)
|
|
25
|
-
properties.id = id;
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export default promoteAnchorIds;
|
|
30
|
-
//# sourceMappingURL=heading-ids.js.map
|
package/dist/heading-ids.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heading-ids.js","sourceRoot":"","sources":["../src/heading-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EACL,eAAe,EACf,cAAc,EACd,mBAAmB,GACpB,MAAM,YAAY,CAAA;AAcnB,MAAM,CAAC,MAAM,gBAAgB,GAA6C,CACxE,OAAO,GAAG,EAAE,EACZ,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,mBAAmB,CAAA;IAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAA;IAE/C,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,OAAgB,EAAE,EAAE;YAC1C,MAAM,EAAE,GAAG,eAAe,CACxB,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,EAC5C,WAAW,CACZ,CAAA;YACD,IAAI,CAAC,EAAE;gBAAE,OAAM;YAEf,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,CAAgB,CAAA;YACjE,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAA;YAC9D,sEAAsE;YACtE,IAAI,UAAU,CAAC,EAAE,KAAK,SAAS;gBAAE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;QACrD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|