cudoc-nextra 0.2.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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +3 -0
- package/dist/components.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cudoment
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# cudoc-nextra
|
|
2
|
+
|
|
3
|
+
Connect cudoc to Nextra while retaining native heading IDs and TOC behavior.
|
|
4
|
+
|
|
5
|
+
ESM · Node.js 20+
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @cudoment/cudoc cudoc-remark cudoc-nextra
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { cudocRemarkPlugins } from "cudoc-nextra"
|
|
13
|
+
|
|
14
|
+
// In the Nextra configuration:
|
|
15
|
+
const mdxOptions = {
|
|
16
|
+
format: "detect",
|
|
17
|
+
remarkPlugins: cudocRemarkPlugins({
|
|
18
|
+
syntax: { headingAnchor: "both", callout: "both" },
|
|
19
|
+
}),
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Keep the existing Nextra theme mappings and import `@cudoment/cudoc/styles.css` once. The explicit `syntax` setup needs no cudoc components. Nextra owns its TOC. For embedding, collect through the actual Nextra compiler, prepare embeds, and add `cudoc-remark/embed` to rendering.
|
|
24
|
+
|
|
25
|
+
Choose `host`, `cudoc` or `both` independently for `headingAnchor`, `badge`, `tableCellList`, `callout` and `link`. The representative callout is `> [!NOTE] Title`. Authors do not register cudoc React components in the recommended setup. Syntax-only rendering needs no stored JSON; cross-document embedding requires document collection.
|
|
26
|
+
|
|
27
|
+
- [Usage guide](https://github.com/cudoment/cudoc/tree/main/docs/nextra.md) · [한국어 가이드](https://github.com/cudoment/cudoc/tree/main/docs/nextra.ko.md)
|
|
28
|
+
- [Markdown syntax](https://github.com/cudoment/cudoc/tree/main/docs/syntax.md)
|
|
29
|
+
- [Embedding](https://github.com/cudoment/cudoc/tree/main/docs/embedding.md)
|
|
30
|
+
- [Standalone HTML alongside a host](https://github.com/cudoment/cudoc/tree/main/docs/html.md#export-alongside-an-existing-site)
|
|
31
|
+
- [API reference](https://github.com/cudoment/cudoc/tree/main/docs/api-reference/README.md)
|
|
32
|
+
- [Runnable examples](https://github.com/cudoment/cudoc/tree/main/examples/README.md)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,cAAc,yBAAyB,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nextra adapter.
|
|
3
|
+
*
|
|
4
|
+
* Nextra puts the plugins given in `mdxOptions.remarkPlugins` at the front of
|
|
5
|
+
* its own pipeline, so cudoc already runs before Nextra assigns heading ids.
|
|
6
|
+
* What this package adds is the anchor id promotion that makes the two agree on
|
|
7
|
+
* one id, and the components under `cudoc-nextra/components`.
|
|
8
|
+
*
|
|
9
|
+
* The arrangement itself is `createHostPlugins`, shared with the Docusaurus
|
|
10
|
+
* adapter, so the two hosts cannot quietly diverge.
|
|
11
|
+
*/
|
|
12
|
+
import type { PluggableList } from "unified";
|
|
13
|
+
import { type HostPluginOptions } from "cudoc-remark";
|
|
14
|
+
export type CudocNextraOptions = HostPluginOptions;
|
|
15
|
+
/**
|
|
16
|
+
* The remark plugins to hand to `mdxOptions.remarkPlugins`.
|
|
17
|
+
*
|
|
18
|
+
* Nextra prepends them to its own list, which is the order cudoc needs: the
|
|
19
|
+
* anchors have to exist before `remarkHeadings` reads heading ids.
|
|
20
|
+
*/
|
|
21
|
+
export declare const cudocRemarkPlugins: (options?: CudocNextraOptions) => PluggableList;
|
|
22
|
+
export { promoteAnchorIds } from "cudoc-remark";
|
|
23
|
+
export type { HostPluginOptions, PromoteAnchorIdsOptions } from "cudoc-remark";
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAA;AAElD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAS,kBAAuB,KAC/B,aAA2D,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nextra adapter.
|
|
3
|
+
*
|
|
4
|
+
* Nextra puts the plugins given in `mdxOptions.remarkPlugins` at the front of
|
|
5
|
+
* its own pipeline, so cudoc already runs before Nextra assigns heading ids.
|
|
6
|
+
* What this package adds is the anchor id promotion that makes the two agree on
|
|
7
|
+
* one id, and the components under `cudoc-nextra/components`.
|
|
8
|
+
*
|
|
9
|
+
* The arrangement itself is `createHostPlugins`, shared with the Docusaurus
|
|
10
|
+
* adapter, so the two hosts cannot quietly diverge.
|
|
11
|
+
*/
|
|
12
|
+
import { createHostPlugins } from "cudoc-remark";
|
|
13
|
+
/**
|
|
14
|
+
* The remark plugins to hand to `mdxOptions.remarkPlugins`.
|
|
15
|
+
*
|
|
16
|
+
* Nextra prepends them to its own list, which is the order cudoc needs: the
|
|
17
|
+
* anchors have to exist before `remarkHeadings` reads heading ids.
|
|
18
|
+
*/
|
|
19
|
+
export const cudocRemarkPlugins = (options = {}) => createHostPlugins(options, "cudoc-nextra");
|
|
20
|
+
export { promoteAnchorIds } from "cudoc-remark";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,iBAAiB,EAA0B,MAAM,cAAc,CAAA;AAIxE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAA8B,EAAE,EACjB,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cudoc-nextra",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Nextra adapter for cudoc: remark wiring and default components.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cudoc",
|
|
7
|
+
"nextra",
|
|
8
|
+
"next",
|
|
9
|
+
"mdx",
|
|
10
|
+
"documentation"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/cudoment/cudoc/tree/main/packages/cudoc-nextra#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-nextra"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "cudoment",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./components": {
|
|
32
|
+
"types": "./dist/components.d.ts",
|
|
33
|
+
"default": "./dist/components.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc --build",
|
|
47
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"cudoc-remark": "0.2.0",
|
|
51
|
+
"unified": "^11.0.5"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|