@docubook/core 1.3.2 → 1.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/dist/compile.d.ts +0 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +21 -31
- package/dist/compile.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/handleCodeExpandable.d.ts +17 -0
- package/dist/plugins/handleCodeExpandable.d.ts.map +1 -0
- package/dist/plugins/handleCodeExpandable.js +130 -0
- package/dist/plugins/handleCodeExpandable.js.map +1 -0
- package/dist/plugins/handleCodeTitles.d.ts +3 -0
- package/dist/plugins/handleCodeTitles.d.ts.map +1 -0
- package/dist/plugins/handleCodeTitles.js +33 -0
- package/dist/plugins/handleCodeTitles.js.map +1 -0
- package/package.json +53 -54
package/dist/compile.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ export type ParseMdxOptions = {
|
|
|
16
16
|
*/
|
|
17
17
|
parseFrontmatter?: boolean;
|
|
18
18
|
};
|
|
19
|
-
export declare const handleCodeTitles: () => (tree: Node) => void;
|
|
20
19
|
export declare const preProcess: () => (tree: Node) => void;
|
|
21
20
|
export declare const postProcess: () => (tree: Node) => void;
|
|
22
21
|
export declare function createDefaultRehypePlugins(): unknown[];
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,OAAO,CAAA;AASzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAoB/C,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAChF,KAAK,iBAAiB,GAAG,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAA;AAChE,KAAK,kBAAkB,GAAG,WAAW,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAA;AAEtE,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,aAAa,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAA;IACnD,aAAa,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAA;IACnD;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,UAAU,SAAU,MAAM,IAAI,SAwB1C,CAAA;AAED,eAAO,MAAM,WAAW,SAAU,MAAM,IAAI,SAe3C,CAAA;AAED,wBAAgB,0BAA0B,IAAI,OAAO,EAAE,CAYtD;AAED,wBAAgB,0BAA0B,IAAI,OAAO,EAAE,CAEtD;AAED,wBAAsB,QAAQ,CAAC,WAAW,EACxC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAiBxC"}
|
package/dist/compile.js
CHANGED
|
@@ -5,36 +5,8 @@ import rehypePrism from "rehype-prism-plus";
|
|
|
5
5
|
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
|
6
6
|
import rehypeSlug from "rehype-slug";
|
|
7
7
|
import rehypeCodeTitles from "rehype-code-titles";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!parent || index === null || node.tagName !== "div") {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const isTitleDiv = node.properties?.className?.includes("rehype-code-title");
|
|
14
|
-
if (!isTitleDiv) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
let nextElement = null;
|
|
18
|
-
for (let i = index + 1; i < parent.children.length; i++) {
|
|
19
|
-
const sibling = parent.children[i];
|
|
20
|
-
if (sibling.type === "element") {
|
|
21
|
-
nextElement = sibling;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (nextElement?.tagName === "pre") {
|
|
26
|
-
const titleNode = node.children?.[0];
|
|
27
|
-
if (titleNode?.type === "text") {
|
|
28
|
-
if (!nextElement.properties) {
|
|
29
|
-
nextElement.properties = {};
|
|
30
|
-
}
|
|
31
|
-
nextElement.properties["data-title"] = titleNode.value;
|
|
32
|
-
parent.children.splice(index, 1);
|
|
33
|
-
return index;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
};
|
|
8
|
+
import { handleCodeTitles } from "./plugins/handleCodeTitles";
|
|
9
|
+
import { handleCodeExpandableRemark, handleCodeExpandable } from "./plugins/handleCodeExpandable";
|
|
38
10
|
export const preProcess = () => (tree) => {
|
|
39
11
|
visit(tree, (node) => {
|
|
40
12
|
const element = node;
|
|
@@ -42,6 +14,16 @@ export const preProcess = () => (tree) => {
|
|
|
42
14
|
const [codeEl] = element.children;
|
|
43
15
|
if (codeEl.tagName !== "code" || !codeEl.children?.[0])
|
|
44
16
|
return;
|
|
17
|
+
const className = codeEl.properties?.className;
|
|
18
|
+
const classList = Array.isArray(className)
|
|
19
|
+
? className
|
|
20
|
+
: typeof className === "string"
|
|
21
|
+
? className.split(" ").filter(Boolean)
|
|
22
|
+
: [];
|
|
23
|
+
const languageClass = classList.find((item) => item.startsWith("language-"));
|
|
24
|
+
if (languageClass) {
|
|
25
|
+
element.language = languageClass.replace("language-", "").split(":")[0];
|
|
26
|
+
}
|
|
45
27
|
const textNode = codeEl.children[0];
|
|
46
28
|
if (textNode.type === "text" && textNode.value) {
|
|
47
29
|
element.raw = textNode.value;
|
|
@@ -56,6 +38,12 @@ export const postProcess = () => (tree) => {
|
|
|
56
38
|
if (element.properties && element.raw) {
|
|
57
39
|
element.properties.raw = element.raw;
|
|
58
40
|
}
|
|
41
|
+
if (element.properties && element.language && !element.properties["data-language"]) {
|
|
42
|
+
element.properties["data-language"] = element.language;
|
|
43
|
+
}
|
|
44
|
+
if (element.properties && element.codeTitle && !element.properties["data-title"]) {
|
|
45
|
+
element.properties["data-title"] = element.codeTitle;
|
|
46
|
+
}
|
|
59
47
|
}
|
|
60
48
|
});
|
|
61
49
|
};
|
|
@@ -64,14 +52,16 @@ export function createDefaultRehypePlugins() {
|
|
|
64
52
|
preProcess,
|
|
65
53
|
rehypeCodeTitles,
|
|
66
54
|
handleCodeTitles,
|
|
55
|
+
handleCodeExpandable,
|
|
67
56
|
rehypePrism,
|
|
57
|
+
handleCodeExpandable,
|
|
68
58
|
rehypeSlug,
|
|
69
59
|
rehypeAutolinkHeadings,
|
|
70
60
|
postProcess,
|
|
71
61
|
];
|
|
72
62
|
}
|
|
73
63
|
export function createDefaultRemarkPlugins() {
|
|
74
|
-
return [remarkGfm];
|
|
64
|
+
return [remarkGfm, handleCodeExpandableRemark];
|
|
75
65
|
}
|
|
76
66
|
export async function parseMdx(rawMdx, options = {}) {
|
|
77
67
|
const rehypePlugins = options.rehypePlugins ?? createDefaultRehypePlugins();
|
package/dist/compile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,SAAS,MAAM,YAAY,C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CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,UAAU;QACV,gBAAgB;QAChB,gBAAgB;QAChB,oBAAoB;QACpB,WAAW;QACX,oBAAoB;QACpB,UAAU;QACV,sBAAsB;QACtB,WAAW;KACZ,CAAA;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAA;AAChD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAAc,EACd,UAA2B,EAAE;IAE7B,MAAM,aAAa,GACjB,OAAO,CAAC,aAAa,IAAK,0BAA0B,EAA0C,CAAA;IAChG,MAAM,aAAa,GACjB,OAAO,CAAC,aAAa,IAAK,0BAA0B,EAA0C,CAAA;IAEhG,OAAO,MAAM,UAAU,CAAc;QACnC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,IAAI;YAClD,UAAU,EAAE;gBACV,aAAa;gBACb,aAAa;aACd;SACF;QACD,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { TocItem, MdxCompileResult } from "./types";
|
|
2
|
-
export { parseMdx, preProcess, postProcess,
|
|
2
|
+
export { parseMdx, preProcess, postProcess, createDefaultRehypePlugins, createDefaultRemarkPlugins, } from "./compile";
|
|
3
|
+
export { handleCodeTitles } from "./plugins/handleCodeTitles";
|
|
4
|
+
export { handleCodeExpandableRemark, handleCodeExpandable } from "./plugins/handleCodeExpandable";
|
|
3
5
|
export { extractFrontmatter, extractFrontmatterWithContent, extractTocsFromRawMdx, sluggify } from "./extract";
|
|
4
6
|
export type { ParseMdxOptions } from "./compile";
|
|
5
7
|
export { readMdxFileBySlug, parseMdxFile, compileParsedMdxFile, createMdxContentService, } from "./content";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EACH,QAAQ,EACR,UAAU,EACV,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EACH,QAAQ,EACR,UAAU,EACV,WAAW,EACX,0BAA0B,EAC1B,0BAA0B,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/G,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,GAC1B,MAAM,WAAW,CAAC;AACnB,YAAY,EACR,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,8BAA8B,GACjC,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { parseMdx, preProcess, postProcess,
|
|
1
|
+
export { parseMdx, preProcess, postProcess, createDefaultRehypePlugins, createDefaultRemarkPlugins, } from "./compile";
|
|
2
|
+
export { handleCodeTitles } from "./plugins/handleCodeTitles";
|
|
3
|
+
export { handleCodeExpandableRemark, handleCodeExpandable } from "./plugins/handleCodeExpandable";
|
|
2
4
|
export { extractFrontmatter, extractFrontmatterWithContent, extractTocsFromRawMdx, sluggify } from "./extract";
|
|
3
5
|
export { readMdxFileBySlug, parseMdxFile, compileParsedMdxFile, createMdxContentService, } from "./content";
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,QAAQ,EACR,UAAU,EACV,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,QAAQ,EACR,UAAU,EACV,WAAW,EACX,0BAA0B,EAC1B,0BAA0B,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/G,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,GAC1B,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Node } from "unist";
|
|
2
|
+
/**
|
|
3
|
+
* Remark plugin to parse expandable metadata from code fences
|
|
4
|
+
* Syntax: ```lang:filename showLineNumbers {lines} Expandable
|
|
5
|
+
*
|
|
6
|
+
* Adds hProperties to code node:
|
|
7
|
+
* - data-expandable: 'true'
|
|
8
|
+
* - data-expandable-lines: total line count
|
|
9
|
+
*/
|
|
10
|
+
export declare const handleCodeExpandableRemark: () => (tree: Node) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Rehype plugin to transform expandable code blocks
|
|
13
|
+
* Copies data-expandable metadata from <code> into <pre>
|
|
14
|
+
* so custom React pre components can receive the attributes via props.
|
|
15
|
+
*/
|
|
16
|
+
export declare const handleCodeExpandable: () => (tree: Node) => void;
|
|
17
|
+
//# sourceMappingURL=handleCodeExpandable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCodeExpandable.d.ts","sourceRoot":"","sources":["../../src/plugins/handleCodeExpandable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AA2BlC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,SAAU,MAAM,IAAI,SAmD1D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SAAU,MAAM,IAAI,SA0EpD,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { visit } from "unist-util-visit";
|
|
2
|
+
/**
|
|
3
|
+
* Remark plugin to parse expandable metadata from code fences
|
|
4
|
+
* Syntax: ```lang:filename showLineNumbers {lines} Expandable
|
|
5
|
+
*
|
|
6
|
+
* Adds hProperties to code node:
|
|
7
|
+
* - data-expandable: 'true'
|
|
8
|
+
* - data-expandable-lines: total line count
|
|
9
|
+
*/
|
|
10
|
+
export const handleCodeExpandableRemark = () => (tree) => {
|
|
11
|
+
visit(tree, "code", (node) => {
|
|
12
|
+
if (!node.meta)
|
|
13
|
+
return;
|
|
14
|
+
const isExpandable = node.meta.includes("Expandable");
|
|
15
|
+
const [languagePart, titlePart] = (node.lang ?? "").split(":");
|
|
16
|
+
const normalizedLanguage = languagePart?.trim();
|
|
17
|
+
const normalizedTitle = titlePart?.trim();
|
|
18
|
+
if (isExpandable) {
|
|
19
|
+
const lineCount = node.value.split("\n").length;
|
|
20
|
+
if (!node.data) {
|
|
21
|
+
node.data = {};
|
|
22
|
+
}
|
|
23
|
+
if (!node.data.hProperties) {
|
|
24
|
+
node.data.hProperties = {};
|
|
25
|
+
}
|
|
26
|
+
node.data.hProperties["data-expandable"] = "true";
|
|
27
|
+
node.data.hProperties["data-expandable-lines"] = lineCount.toString();
|
|
28
|
+
if (normalizedLanguage) {
|
|
29
|
+
node.data.hProperties["data-language"] = normalizedLanguage;
|
|
30
|
+
}
|
|
31
|
+
if (normalizedTitle) {
|
|
32
|
+
node.data.hProperties["data-title"] = normalizedTitle;
|
|
33
|
+
}
|
|
34
|
+
const currentClassName = node.data.hProperties.className;
|
|
35
|
+
const classList = Array.isArray(currentClassName)
|
|
36
|
+
? currentClassName
|
|
37
|
+
: typeof currentClassName === "string"
|
|
38
|
+
? currentClassName.split(" ").filter(Boolean)
|
|
39
|
+
: [];
|
|
40
|
+
if (!classList.includes("mdx-expandable-meta")) {
|
|
41
|
+
classList.push("mdx-expandable-meta");
|
|
42
|
+
}
|
|
43
|
+
node.data.hProperties.className = classList;
|
|
44
|
+
if (normalizedLanguage && !node.meta.includes("dbLang(")) {
|
|
45
|
+
node.meta = `${node.meta} dbLang(${normalizedLanguage})`.trim();
|
|
46
|
+
}
|
|
47
|
+
if (normalizedTitle && !node.meta.includes("dbTitle(")) {
|
|
48
|
+
node.meta = `${node.meta} dbTitle(${normalizedTitle})`.trim();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Rehype plugin to transform expandable code blocks
|
|
55
|
+
* Copies data-expandable metadata from <code> into <pre>
|
|
56
|
+
* so custom React pre components can receive the attributes via props.
|
|
57
|
+
*/
|
|
58
|
+
export const handleCodeExpandable = () => (tree) => {
|
|
59
|
+
visit(tree, "element", (node) => {
|
|
60
|
+
if (node.tagName !== "pre")
|
|
61
|
+
return;
|
|
62
|
+
const codeElement = node.children?.find((child) => {
|
|
63
|
+
const element = child;
|
|
64
|
+
return element.type === "element" && element.tagName === "code";
|
|
65
|
+
});
|
|
66
|
+
const codeClassName = codeElement?.properties?.className;
|
|
67
|
+
const codeClassList = Array.isArray(codeClassName)
|
|
68
|
+
? codeClassName
|
|
69
|
+
: typeof codeClassName === "string"
|
|
70
|
+
? codeClassName.split(" ").filter(Boolean)
|
|
71
|
+
: [];
|
|
72
|
+
const codeMeta = typeof codeElement?.data?.meta === "string" ? codeElement.data.meta : undefined;
|
|
73
|
+
const languageFromMeta = codeMeta?.match(/dbLang\(([^)]+)\)/)?.[1];
|
|
74
|
+
const titleFromMeta = codeMeta?.match(/dbTitle\(([^)]+)\)/)?.[1];
|
|
75
|
+
const isExpandable = codeElement?.properties?.["data-expandable"] === "true" ||
|
|
76
|
+
codeClassList.includes("mdx-expandable-meta") ||
|
|
77
|
+
codeMeta?.includes("Expandable") === true;
|
|
78
|
+
const expandableLines = codeElement?.properties?.["data-expandable-lines"];
|
|
79
|
+
if (!isExpandable)
|
|
80
|
+
return;
|
|
81
|
+
if (!node.properties) {
|
|
82
|
+
node.properties = {};
|
|
83
|
+
}
|
|
84
|
+
node.properties["data-expandable"] = "true";
|
|
85
|
+
if (typeof expandableLines === "string" || typeof expandableLines === "number") {
|
|
86
|
+
node.properties["data-expandable-lines"] = expandableLines.toString();
|
|
87
|
+
}
|
|
88
|
+
else if (node.raw) {
|
|
89
|
+
node.properties["data-expandable-lines"] = node.raw.split("\n").length.toString();
|
|
90
|
+
}
|
|
91
|
+
if (languageFromMeta) {
|
|
92
|
+
node.properties["data-language"] = languageFromMeta;
|
|
93
|
+
}
|
|
94
|
+
else if (node.language) {
|
|
95
|
+
node.properties["data-language"] = node.language;
|
|
96
|
+
}
|
|
97
|
+
if (titleFromMeta) {
|
|
98
|
+
node.properties["data-title"] = titleFromMeta;
|
|
99
|
+
}
|
|
100
|
+
else if (node.codeTitle) {
|
|
101
|
+
node.properties["data-title"] = node.codeTitle;
|
|
102
|
+
}
|
|
103
|
+
const className = node.properties.className;
|
|
104
|
+
if (!className) {
|
|
105
|
+
node.properties.className = [];
|
|
106
|
+
}
|
|
107
|
+
// Ensure className includes expandable marker
|
|
108
|
+
if (Array.isArray(node.properties.className)) {
|
|
109
|
+
if (!node.properties.className.includes("mdx-expandable-code")) {
|
|
110
|
+
node.properties.className.push("mdx-expandable-code");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (typeof className === "string") {
|
|
114
|
+
const hasMarker = className.split(" ").includes("mdx-expandable-code");
|
|
115
|
+
if (!hasMarker) {
|
|
116
|
+
node.properties.className = `${className} mdx-expandable-code`
|
|
117
|
+
.trim()
|
|
118
|
+
.split(" ");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
node.properties.className = ["mdx-expandable-code"];
|
|
123
|
+
}
|
|
124
|
+
if (codeElement?.properties) {
|
|
125
|
+
const cleanedCodeClassList = codeClassList.filter((className) => className !== "mdx-expandable-meta");
|
|
126
|
+
codeElement.properties.className = cleanedCodeClassList;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=handleCodeExpandable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCodeExpandable.js","sourceRoot":"","sources":["../../src/plugins/handleCodeExpandable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA0BzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IAC3D,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAc,EAAE,EAAE;QACnC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO;QAEvB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACtD,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/D,MAAM,kBAAkB,GAAG,YAAY,EAAE,IAAI,EAAE,CAAC;QAChD,MAAM,eAAe,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC;QAE1C,IAAI,YAAY,EAAE,CAAC;YACf,MA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SAAS,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,WAAW,EAAE,UAAU,EAAE,CAAC;YAC1B,MAAM,oBAAoB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,qBAAqB,CAAC,CAAC;YACtG,WAAW,CAAC,UAAU,CAAC,SAAS,GAAG,oBAAoB,CAAC;QAC5D,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCodeTitles.d.ts","sourceRoot":"","sources":["../../src/plugins/handleCodeTitles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,OAAO,CAAC;AAoB1C,eAAO,MAAM,gBAAgB,SAAU,MAAM,IAAI,SAiChD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { visit } from "unist-util-visit";
|
|
2
|
+
export const handleCodeTitles = () => (tree) => {
|
|
3
|
+
visit(tree, "element", (node, index, parent) => {
|
|
4
|
+
if (!parent || index === null || node.tagName !== "div") {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const isTitleDiv = node.properties?.className?.includes("rehype-code-title");
|
|
8
|
+
if (!isTitleDiv) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let nextElement = null;
|
|
12
|
+
for (let i = index + 1; i < parent.children.length; i++) {
|
|
13
|
+
const sibling = parent.children[i];
|
|
14
|
+
if (sibling.type === "element") {
|
|
15
|
+
nextElement = sibling;
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (nextElement?.tagName === "pre") {
|
|
20
|
+
const titleNode = node.children?.[0];
|
|
21
|
+
if (titleNode?.type === "text") {
|
|
22
|
+
if (!nextElement.properties) {
|
|
23
|
+
nextElement.properties = {};
|
|
24
|
+
}
|
|
25
|
+
nextElement.properties["data-title"] = titleNode.value;
|
|
26
|
+
nextElement.codeTitle = titleNode.value;
|
|
27
|
+
parent.children.splice(index, 1);
|
|
28
|
+
return index;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=handleCodeTitles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCodeTitles.js","sourceRoot":"","sources":["../../src/plugins/handleCodeTitles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAmBzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IACjD,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,IAAa,EAAE,KAAoB,EAAE,MAAqB,EAAE,EAAE;QAClF,IAAI,CAAC,MAAM,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YACtD,OAAO;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC7E,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO;QACX,CAAC;QAED,IAAI,WAAW,GAAmB,IAAI,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACnC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC7B,WAAW,GAAG,OAAkB,CAAC;gBACjC,MAAM;YACV,CAAC;QACL,CAAC;QAED,IAAI,WAAW,EAAE,OAAO,KAAK,KAAK,EAAE,CAAC;YACjC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAa,CAAC;YACjD,IAAI,SAAS,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC7B,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;oBAC1B,WAAW,CAAC,UAAU,GAAG,EAAE,CAAC;gBAChC,CAAC;gBACD,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC;gBACvD,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC;gBACxC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBACjC,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "tsc -p tsconfig.json",
|
|
20
|
-
"clean": "rm -rf dist",
|
|
21
|
-
"prepublishOnly": "pnpm run clean && pnpm run build"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"docubook",
|
|
25
|
-
"documentation",
|
|
26
|
-
"docs framework",
|
|
27
|
-
"mdx compile",
|
|
28
|
-
"markdown utilities"
|
|
29
|
-
],
|
|
30
|
-
"homepage": "https://docubook.pro/",
|
|
31
|
-
"repository": {
|
|
32
|
-
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/DocuBook/docubook.git"
|
|
34
|
-
},
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"author": "wildan.nrs",
|
|
39
|
-
"author-url": "https://wildan.dev",
|
|
40
|
-
"license": "MIT",
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"gray-matter": "^4.0.3",
|
|
43
|
-
"next-mdx-remote": "^6.0.0",
|
|
44
|
-
"rehype-autolink-headings": "^7.1.0",
|
|
45
|
-
"rehype-code-titles": "^1.2.1",
|
|
46
|
-
"rehype-prism-plus": "^2.0.2",
|
|
47
|
-
"rehype-slug": "^6.0.0",
|
|
48
|
-
"remark-gfm": "^4.0.1",
|
|
49
|
-
"unist-util-visit": "^5.1.0"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@types/node": "^20.19.37",
|
|
53
|
-
"@types/react": "19.2.8",
|
|
54
|
-
"@types/unist": "^3.0.3",
|
|
55
|
-
"typescript": "^5.9.3"
|
|
2
|
+
"name": "@docubook/core",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Shared MDX compile pipeline and markdown utilities for DocuBook",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
56
13
|
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"docubook",
|
|
20
|
+
"documentation",
|
|
21
|
+
"docs framework",
|
|
22
|
+
"mdx compile",
|
|
23
|
+
"markdown utilities"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://docubook.pro/",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/DocuBook/docubook.git"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"author": "wildan.nrs",
|
|
34
|
+
"author-url": "https://wildan.dev",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"gray-matter": "^4.0.3",
|
|
38
|
+
"next-mdx-remote": "^6.0.0",
|
|
39
|
+
"rehype-autolink-headings": "^7.1.0",
|
|
40
|
+
"rehype-code-titles": "^1.2.1",
|
|
41
|
+
"rehype-prism-plus": "^2.0.2",
|
|
42
|
+
"rehype-slug": "^6.0.0",
|
|
43
|
+
"remark-gfm": "^4.0.1",
|
|
44
|
+
"unist-util-visit": "^5.1.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^20.19.37",
|
|
48
|
+
"@types/react": "19.2.8",
|
|
49
|
+
"@types/unist": "^3.0.3",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -p tsconfig.json",
|
|
54
|
+
"clean": "rm -rf dist"
|
|
55
|
+
}
|
|
57
56
|
}
|