cudoc-eleventy 0.4.0 → 0.6.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/README.md +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +16 -8
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# cudoc-eleventy
|
|
2
2
|
|
|
3
|
-
Connect cudoc to Eleventy while retaining native heading IDs and TOC behavior.
|
|
3
|
+
Connect cudoc to Eleventy as its markdown-it library, set with `eleventyConfig.setLibrary("md", …)` rather than `addPlugin`, while retaining native heading IDs and TOC behavior.
|
|
4
4
|
|
|
5
5
|
ESM · Node.js 20+
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install @cudoment/cudoc cudoc-markdown-it
|
|
8
|
+
npm install @cudoment/cudoc cudoc-eleventy markdown-it-attrs markdown-it-anchor
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```js
|
|
@@ -33,6 +33,6 @@ Choose `host`, `cudoc` or `both` independently for `headingAnchor`, `badge`, `ta
|
|
|
33
33
|
- [Usage guide](https://github.com/cudoment/cudoc/tree/main/docs/eleventy.md) · [한국어 가이드](https://github.com/cudoment/cudoc/tree/main/docs/eleventy.ko.md)
|
|
34
34
|
- [Markdown syntax](https://github.com/cudoment/cudoc/tree/main/docs/syntax.md)
|
|
35
35
|
- [Embedding](https://github.com/cudoment/cudoc/tree/main/docs/embedding.md)
|
|
36
|
-
- [Standalone HTML alongside a host](https://github.com/cudoment/cudoc/tree/main/docs/
|
|
36
|
+
- [Standalone HTML alongside a host](https://github.com/cudoment/cudoc/tree/main/docs/export.md#export-alongside-an-existing-site)
|
|
37
37
|
- [API reference](https://github.com/cudoment/cudoc/tree/main/docs/api-reference/README.md)
|
|
38
38
|
- [Runnable examples](https://github.com/cudoment/cudoc/tree/main/examples/README.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export type EleventyOptions = HostPluginOptions;
|
|
|
21
21
|
* Install on the markdown-it instance handed to `eleventyConfig.setLibrary`.
|
|
22
22
|
*
|
|
23
23
|
* Register the site's own markdown-it plugins first so their tokens already
|
|
24
|
-
* exist when cudoc reads the stream.
|
|
24
|
+
* exist when cudoc reads the stream. Handed to `eleventyConfig.addPlugin`
|
|
25
|
+
* instead, it receives the Eleventy configuration and says so.
|
|
25
26
|
*/
|
|
26
27
|
export default function cudocEleventy(md: MarkdownIt, options?: EleventyOptions): void;
|
|
27
28
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AAEzC,OAAO,EAIL,KAAK,iBAAiB,EAEvB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAqC/C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,EAAE,EAAE,UAAU,EACd,OAAO,GAAE,eAAoB,GAC5B,IAAI,CAkBN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,eAAoB,EAC7B,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,GACnC,UAAU,CAMZ;AAED,+FAA+F;AAC/F,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,UAAU,GAAG,gBAAgB,CAEvE"}
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import markdownIt from "markdown-it";
|
|
17
17
|
import matter from "gray-matter";
|
|
18
|
-
import { installHostPlugin, createHostCompiler, } from "cudoc-markdown-it";
|
|
18
|
+
import { installHostPlugin, createHostCompiler, markdownItText, } from "cudoc-markdown-it";
|
|
19
19
|
const readPage = (env) => {
|
|
20
20
|
const page = env.page;
|
|
21
21
|
if (typeof page !== "object" || page === null)
|
|
@@ -43,13 +43,19 @@ const eleventy = {
|
|
|
43
43
|
* Install on the markdown-it instance handed to `eleventyConfig.setLibrary`.
|
|
44
44
|
*
|
|
45
45
|
* Register the site's own markdown-it plugins first so their tokens already
|
|
46
|
-
* exist when cudoc reads the stream.
|
|
46
|
+
* exist when cudoc reads the stream. Handed to `eleventyConfig.addPlugin`
|
|
47
|
+
* instead, it receives the Eleventy configuration and says so.
|
|
47
48
|
*/
|
|
48
49
|
export default function cudocEleventy(md, options = {}) {
|
|
50
|
+
if (!md?.core &&
|
|
51
|
+
typeof md?.setLibrary === "function")
|
|
52
|
+
throw new Error('cudoc-eleventy: this is a markdown-it plugin, not an Eleventy plugin; pass createMarkdownRenderer(options) to eleventyConfig.setLibrary("md", …) instead of eleventyConfig.addPlugin');
|
|
49
53
|
installHostPlugin(md, options, eleventy);
|
|
50
54
|
md.core.ruler.before("cudoc", "cudoc-eleventy-source", (state) => {
|
|
55
|
+
// Eleventy hands over the file's text as saved; markdown-it has already
|
|
56
|
+
// read its `\r\n` as `\n` by the time this rule runs.
|
|
51
57
|
const raw = state.env.page?.rawInput;
|
|
52
|
-
if (typeof raw === "string" && raw !== state.src)
|
|
58
|
+
if (typeof raw === "string" && markdownItText(raw).text !== state.src)
|
|
53
59
|
throw new Error("cudoc-eleventy: another template engine rewrote this Markdown before markdown-it; set markdownTemplateEngine: false");
|
|
54
60
|
});
|
|
55
61
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GAGf,MAAM,mBAAmB,CAAA;AAW1B,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAgB,EAAE;IAC9D,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAC3C,MAAM,IAAI,KAAK,CACb,kIAAkI,CACnI,CAAA;IACH,OAAO,IAAoB,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,QAAQ,GAAmB;IAC/B,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE,UAAU;IAChB,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;QAClB,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;QACtC,IAAI,OAAO,YAAY,KAAK,QAAQ;YAClC,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;QACH,OAAO,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACxC,CAAC;IACD,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,E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;AACX,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,sBAAsB,CAAC,EAAc;IACnD,OAAO,kBAAkB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cudoc-eleventy",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Eleventy
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Eleventy markdown-it library for cudoc: Markdown syntax extensions, document collection and embedding",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/cudoment/cudoc.git",
|
|
9
9
|
"directory": "packages/cudoc-eleventy"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/cudoment/cudoc
|
|
11
|
+
"homepage": "https://github.com/cudoment/cudoc#readme",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/cudoment/cudoc/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"cudoc",
|
|
17
17
|
"eleventy",
|
|
18
|
+
"eleventy-plugin",
|
|
18
19
|
"11ty",
|
|
19
20
|
"markdown",
|
|
20
21
|
"documentation"
|
|
@@ -26,7 +27,8 @@
|
|
|
26
27
|
".": {
|
|
27
28
|
"types": "./dist/index.d.ts",
|
|
28
29
|
"default": "./dist/index.js"
|
|
29
|
-
}
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
30
32
|
},
|
|
31
33
|
"files": [
|
|
32
34
|
"dist",
|
|
@@ -41,13 +43,14 @@
|
|
|
41
43
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@cudoment/cudoc": "0.
|
|
45
|
-
"cudoc-markdown-it": "0.
|
|
46
|
+
"@cudoment/cudoc": "0.6.0",
|
|
47
|
+
"cudoc-markdown-it": "0.6.0",
|
|
46
48
|
"gray-matter": "^4.0.3"
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
|
-
"@11ty/eleventy": "^3.
|
|
50
|
-
"markdown-it": "^14.1.0"
|
|
51
|
+
"@11ty/eleventy": "^3.1.0",
|
|
52
|
+
"markdown-it": "^14.1.0",
|
|
53
|
+
"@types/markdown-it": "^14.1.0"
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@types/markdown-it": "^14.2.0"
|
|
@@ -55,5 +58,10 @@
|
|
|
55
58
|
"author": "cudoment",
|
|
56
59
|
"engines": {
|
|
57
60
|
"node": ">=20"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@types/markdown-it": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
}
|