docusaurus-plugin-gitbook 0.1.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 +210 -0
- package/lib/index.d.ts +51 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +39 -0
- package/lib/index.js.map +1 -0
- package/lib/parser/index.d.ts +6 -0
- package/lib/parser/index.d.ts.map +1 -0
- package/lib/parser/index.js +6 -0
- package/lib/parser/index.js.map +1 -0
- package/lib/parser/parser.d.ts +43 -0
- package/lib/parser/parser.d.ts.map +1 -0
- package/lib/parser/parser.js +192 -0
- package/lib/parser/parser.js.map +1 -0
- package/lib/parser/tokenizer.d.ts +37 -0
- package/lib/parser/tokenizer.d.ts.map +1 -0
- package/lib/parser/tokenizer.js +172 -0
- package/lib/parser/tokenizer.js.map +1 -0
- package/lib/rehype/index.d.ts +7 -0
- package/lib/rehype/index.d.ts.map +1 -0
- package/lib/rehype/index.js +6 -0
- package/lib/rehype/index.js.map +1 -0
- package/lib/rehype/plugin.d.ts +18 -0
- package/lib/rehype/plugin.d.ts.map +1 -0
- package/lib/rehype/plugin.js +31 -0
- package/lib/rehype/plugin.js.map +1 -0
- package/lib/rehype/transformers/all.d.ts +8 -0
- package/lib/rehype/transformers/all.d.ts.map +1 -0
- package/lib/rehype/transformers/all.js +10 -0
- package/lib/rehype/transformers/all.js.map +1 -0
- package/lib/rehype/transformers/button.d.ts +17 -0
- package/lib/rehype/transformers/button.d.ts.map +1 -0
- package/lib/rehype/transformers/button.js +46 -0
- package/lib/rehype/transformers/button.js.map +1 -0
- package/lib/rehype/transformers/cards.d.ts +17 -0
- package/lib/rehype/transformers/cards.d.ts.map +1 -0
- package/lib/rehype/transformers/cards.js +111 -0
- package/lib/rehype/transformers/cards.js.map +1 -0
- package/lib/rehype/transformers/expression.d.ts +17 -0
- package/lib/rehype/transformers/expression.d.ts.map +1 -0
- package/lib/rehype/transformers/expression.js +50 -0
- package/lib/rehype/transformers/expression.js.map +1 -0
- package/lib/rehype/transformers/icon.d.ts +18 -0
- package/lib/rehype/transformers/icon.d.ts.map +1 -0
- package/lib/rehype/transformers/icon.js +48 -0
- package/lib/rehype/transformers/icon.js.map +1 -0
- package/lib/rehype/transformers/index.d.ts +26 -0
- package/lib/rehype/transformers/index.d.ts.map +1 -0
- package/lib/rehype/transformers/index.js +31 -0
- package/lib/rehype/transformers/index.js.map +1 -0
- package/lib/remark/index.d.ts +8 -0
- package/lib/remark/index.d.ts.map +1 -0
- package/lib/remark/index.js +7 -0
- package/lib/remark/index.js.map +1 -0
- package/lib/remark/plugin.d.ts +22 -0
- package/lib/remark/plugin.d.ts.map +1 -0
- package/lib/remark/plugin.js +231 -0
- package/lib/remark/plugin.js.map +1 -0
- package/lib/remark/transformers/all.d.ts +14 -0
- package/lib/remark/transformers/all.d.ts.map +1 -0
- package/lib/remark/transformers/all.js +16 -0
- package/lib/remark/transformers/all.js.map +1 -0
- package/lib/remark/transformers/code.d.ts +13 -0
- package/lib/remark/transformers/code.d.ts.map +1 -0
- package/lib/remark/transformers/code.js +35 -0
- package/lib/remark/transformers/code.js.map +1 -0
- package/lib/remark/transformers/columns.d.ts +17 -0
- package/lib/remark/transformers/columns.d.ts.map +1 -0
- package/lib/remark/transformers/columns.js +41 -0
- package/lib/remark/transformers/columns.js.map +1 -0
- package/lib/remark/transformers/embed.d.ts +12 -0
- package/lib/remark/transformers/embed.d.ts.map +1 -0
- package/lib/remark/transformers/embed.js +23 -0
- package/lib/remark/transformers/embed.js.map +1 -0
- package/lib/remark/transformers/file.d.ts +13 -0
- package/lib/remark/transformers/file.d.ts.map +1 -0
- package/lib/remark/transformers/file.js +26 -0
- package/lib/remark/transformers/file.js.map +1 -0
- package/lib/remark/transformers/hint.d.ts +19 -0
- package/lib/remark/transformers/hint.d.ts.map +1 -0
- package/lib/remark/transformers/hint.js +37 -0
- package/lib/remark/transformers/hint.js.map +1 -0
- package/lib/remark/transformers/include.d.ts +16 -0
- package/lib/remark/transformers/include.d.ts.map +1 -0
- package/lib/remark/transformers/include.js +28 -0
- package/lib/remark/transformers/include.js.map +1 -0
- package/lib/remark/transformers/index.d.ts +27 -0
- package/lib/remark/transformers/index.d.ts.map +1 -0
- package/lib/remark/transformers/index.js +32 -0
- package/lib/remark/transformers/index.js.map +1 -0
- package/lib/remark/transformers/openapi.d.ts +17 -0
- package/lib/remark/transformers/openapi.d.ts.map +1 -0
- package/lib/remark/transformers/openapi.js +30 -0
- package/lib/remark/transformers/openapi.js.map +1 -0
- package/lib/remark/transformers/stepper.d.ts +17 -0
- package/lib/remark/transformers/stepper.d.ts.map +1 -0
- package/lib/remark/transformers/stepper.js +44 -0
- package/lib/remark/transformers/stepper.js.map +1 -0
- package/lib/remark/transformers/tabs.d.ts +18 -0
- package/lib/remark/transformers/tabs.d.ts.map +1 -0
- package/lib/remark/transformers/tabs.js +45 -0
- package/lib/remark/transformers/tabs.js.map +1 -0
- package/lib/remark/transformers/updates.d.ts +17 -0
- package/lib/remark/transformers/updates.d.ts.map +1 -0
- package/lib/remark/transformers/updates.js +44 -0
- package/lib/remark/transformers/updates.js.map +1 -0
- package/lib/remark/utils.d.ts +39 -0
- package/lib/remark/utils.d.ts.map +1 -0
- package/lib/remark/utils.js +139 -0
- package/lib/remark/utils.js.map +1 -0
- package/lib/theme/FAIcon/index.d.ts +10 -0
- package/lib/theme/FAIcon/index.d.ts.map +1 -0
- package/lib/theme/FAIcon/index.js +5 -0
- package/lib/theme/FAIcon/index.js.map +1 -0
- package/lib/theme/GitBookButton/index.d.ts +9 -0
- package/lib/theme/GitBookButton/index.d.ts.map +1 -0
- package/lib/theme/GitBookButton/index.js +6 -0
- package/lib/theme/GitBookButton/index.js.map +1 -0
- package/lib/theme/GitBookButton/styles.module.css +66 -0
- package/lib/theme/GitBookCard/index.d.ts +9 -0
- package/lib/theme/GitBookCard/index.d.ts.map +1 -0
- package/lib/theme/GitBookCard/index.js +6 -0
- package/lib/theme/GitBookCard/index.js.map +1 -0
- package/lib/theme/GitBookCard/styles.module.css +51 -0
- package/lib/theme/GitBookCards/index.d.ts +9 -0
- package/lib/theme/GitBookCards/index.d.ts.map +1 -0
- package/lib/theme/GitBookCards/index.js +6 -0
- package/lib/theme/GitBookCards/index.js.map +1 -0
- package/lib/theme/GitBookCards/styles.module.css +16 -0
- package/lib/theme/GitBookCodeBlock/index.d.ts +9 -0
- package/lib/theme/GitBookCodeBlock/index.d.ts.map +1 -0
- package/lib/theme/GitBookCodeBlock/index.js +6 -0
- package/lib/theme/GitBookCodeBlock/index.js.map +1 -0
- package/lib/theme/GitBookCodeBlock/styles.module.css +59 -0
- package/lib/theme/GitBookColumn/index.d.ts +9 -0
- package/lib/theme/GitBookColumn/index.d.ts.map +1 -0
- package/lib/theme/GitBookColumn/index.js +6 -0
- package/lib/theme/GitBookColumn/index.js.map +1 -0
- package/lib/theme/GitBookColumn/styles.module.css +16 -0
- package/lib/theme/GitBookColumns/index.d.ts +9 -0
- package/lib/theme/GitBookColumns/index.d.ts.map +1 -0
- package/lib/theme/GitBookColumns/index.js +6 -0
- package/lib/theme/GitBookColumns/index.js.map +1 -0
- package/lib/theme/GitBookColumns/styles.module.css +17 -0
- package/lib/theme/GitBookEmbed/index.d.ts +9 -0
- package/lib/theme/GitBookEmbed/index.d.ts.map +1 -0
- package/lib/theme/GitBookEmbed/index.js +71 -0
- package/lib/theme/GitBookEmbed/index.js.map +1 -0
- package/lib/theme/GitBookEmbed/styles.module.css +37 -0
- package/lib/theme/GitBookExpression/index.d.ts +13 -0
- package/lib/theme/GitBookExpression/index.d.ts.map +1 -0
- package/lib/theme/GitBookExpression/index.js +12 -0
- package/lib/theme/GitBookExpression/index.js.map +1 -0
- package/lib/theme/GitBookExpression/styles.module.css +16 -0
- package/lib/theme/GitBookFile/index.d.ts +9 -0
- package/lib/theme/GitBookFile/index.d.ts.map +1 -0
- package/lib/theme/GitBookFile/index.js +42 -0
- package/lib/theme/GitBookFile/index.js.map +1 -0
- package/lib/theme/GitBookFile/styles.module.css +61 -0
- package/lib/theme/GitBookInclude/index.d.ts +19 -0
- package/lib/theme/GitBookInclude/index.d.ts.map +1 -0
- package/lib/theme/GitBookInclude/index.js +8 -0
- package/lib/theme/GitBookInclude/index.js.map +1 -0
- package/lib/theme/GitBookInclude/styles.module.css +77 -0
- package/lib/theme/GitBookOpenAPI/index.d.ts +14 -0
- package/lib/theme/GitBookOpenAPI/index.d.ts.map +1 -0
- package/lib/theme/GitBookOpenAPI/index.js +73 -0
- package/lib/theme/GitBookOpenAPI/index.js.map +1 -0
- package/lib/theme/GitBookOpenAPI/styles.module.css +214 -0
- package/lib/theme/GitBookStep/index.d.ts +13 -0
- package/lib/theme/GitBookStep/index.d.ts.map +1 -0
- package/lib/theme/GitBookStep/index.js +6 -0
- package/lib/theme/GitBookStep/index.js.map +1 -0
- package/lib/theme/GitBookStep/styles.module.css +62 -0
- package/lib/theme/GitBookStepper/index.d.ts +9 -0
- package/lib/theme/GitBookStepper/index.d.ts.map +1 -0
- package/lib/theme/GitBookStepper/index.js +6 -0
- package/lib/theme/GitBookStepper/index.js.map +1 -0
- package/lib/theme/GitBookStepper/styles.module.css +7 -0
- package/lib/theme/GitBookTab/index.d.ts +12 -0
- package/lib/theme/GitBookTab/index.d.ts.map +1 -0
- package/lib/theme/GitBookTab/index.js +9 -0
- package/lib/theme/GitBookTab/index.js.map +1 -0
- package/lib/theme/GitBookTab/styles.module.css +15 -0
- package/lib/theme/GitBookTabs/index.d.ts +9 -0
- package/lib/theme/GitBookTabs/index.d.ts.map +1 -0
- package/lib/theme/GitBookTabs/index.js +32 -0
- package/lib/theme/GitBookTabs/index.js.map +1 -0
- package/lib/theme/GitBookTabs/styles.module.css +57 -0
- package/lib/theme/GitBookUpdate/index.d.ts +9 -0
- package/lib/theme/GitBookUpdate/index.d.ts.map +1 -0
- package/lib/theme/GitBookUpdate/index.js +21 -0
- package/lib/theme/GitBookUpdate/index.js.map +1 -0
- package/lib/theme/GitBookUpdate/styles.module.css +68 -0
- package/lib/theme/GitBookUpdates/index.d.ts +9 -0
- package/lib/theme/GitBookUpdates/index.d.ts.map +1 -0
- package/lib/theme/GitBookUpdates/index.js +6 -0
- package/lib/theme/GitBookUpdates/index.js.map +1 -0
- package/lib/theme/GitBookUpdates/styles.module.css +15 -0
- package/lib/theme/gitbook.css +205 -0
- package/lib/theme-types.d.ts +129 -0
- package/lib/theme-types.d.ts.map +1 -0
- package/lib/theme-types.js +5 -0
- package/lib/theme-types.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% file src="..." %}description{% endfile %}
|
|
5
|
+
* into GitBookFile component
|
|
6
|
+
*/
|
|
7
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
8
|
+
import { registerTransformer } from './index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Transform a file block into MDX JSX element
|
|
11
|
+
*/
|
|
12
|
+
const fileTransformer = (block, transformContent) => {
|
|
13
|
+
const src = block.attributes.src || '';
|
|
14
|
+
if (!src) {
|
|
15
|
+
console.warn('File block missing src attribute');
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
// Transform description content
|
|
19
|
+
const children = block.content ? transformContent(block.content) : [];
|
|
20
|
+
const element = createMdxJsxElement('GitBookFile', { src }, children);
|
|
21
|
+
return [element];
|
|
22
|
+
};
|
|
23
|
+
// Register transformer
|
|
24
|
+
registerTransformer('file', fileTransformer);
|
|
25
|
+
export { fileTransformer };
|
|
26
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/remark/transformers/file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,eAAe,GAAqB,CACxC,KAAmB,EACnB,gBAAgD,EAC9B,EAAE;IACpB,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC;IAEvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gCAAgC;IAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,MAAM,OAAO,GAAG,mBAAmB,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAEtE,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,uBAAuB;AACvB,mBAAmB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hint block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% hint style="info" %}content{% endhint %}
|
|
5
|
+
* into Docusaurus Admonition component (@theme/Admonition)
|
|
6
|
+
*
|
|
7
|
+
* GitBook hint styles map to Docusaurus admonition types:
|
|
8
|
+
* info → info
|
|
9
|
+
* warning → warning
|
|
10
|
+
* danger → danger
|
|
11
|
+
* success → tip
|
|
12
|
+
*/
|
|
13
|
+
import { type BlockTransformer } from './index.js';
|
|
14
|
+
/**
|
|
15
|
+
* Transform a hint block into a Docusaurus Admonition
|
|
16
|
+
*/
|
|
17
|
+
declare const hintTransformer: BlockTransformer;
|
|
18
|
+
export { hintTransformer };
|
|
19
|
+
//# sourceMappingURL=hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAUxE;;GAEG;AACH,QAAA,MAAM,eAAe,EAAE,gBActB,CAAC;AAKF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hint block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% hint style="info" %}content{% endhint %}
|
|
5
|
+
* into Docusaurus Admonition component (@theme/Admonition)
|
|
6
|
+
*
|
|
7
|
+
* GitBook hint styles map to Docusaurus admonition types:
|
|
8
|
+
* info → info
|
|
9
|
+
* warning → warning
|
|
10
|
+
* danger → danger
|
|
11
|
+
* success → tip
|
|
12
|
+
*/
|
|
13
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
14
|
+
import { registerTransformer } from './index.js';
|
|
15
|
+
// Map GitBook hint styles to Docusaurus admonition types
|
|
16
|
+
const STYLE_TO_ADMONITION = {
|
|
17
|
+
info: 'info',
|
|
18
|
+
warning: 'warning',
|
|
19
|
+
danger: 'danger',
|
|
20
|
+
success: 'tip',
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Transform a hint block into a Docusaurus Admonition
|
|
24
|
+
*/
|
|
25
|
+
const hintTransformer = (block, transformContent) => {
|
|
26
|
+
const style = block.attributes.style || 'info';
|
|
27
|
+
const admonitionType = STYLE_TO_ADMONITION[style] || 'info';
|
|
28
|
+
// Transform the content inside the hint
|
|
29
|
+
const children = transformContent(block.content);
|
|
30
|
+
// Use Docusaurus's built-in Admonition component
|
|
31
|
+
const element = createMdxJsxElement('Admonition', { type: admonitionType }, children);
|
|
32
|
+
return [element];
|
|
33
|
+
};
|
|
34
|
+
// Register the transformer
|
|
35
|
+
registerTransformer('hint', hintTransformer);
|
|
36
|
+
export { hintTransformer };
|
|
37
|
+
//# sourceMappingURL=hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hint.js","sourceRoot":"","sources":["../../../src/remark/transformers/hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AAExE,yDAAyD;AACzD,MAAM,mBAAmB,GAA2B;IAClD,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAqB,CACxC,KAAmB,EACnB,gBAAgD,EAC9B,EAAE;IACpB,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,MAAM,CAAC;IAC/C,MAAM,cAAc,GAAG,mBAAmB,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC;IAE5D,wCAAwC;IACxC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEjD,iDAAiD;IACjD,MAAM,OAAO,GAAG,mBAAmB,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,QAAQ,CAAC,CAAC;IAEtF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,2BAA2B;AAC3B,mBAAmB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Include block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% include "path/to/file.md" %} into GitBookInclude component
|
|
5
|
+
*
|
|
6
|
+
* Note: Full file inclusion at build time requires Docusaurus integration.
|
|
7
|
+
* This transformer renders a component that displays the include reference.
|
|
8
|
+
* For actual file inclusion, consider using Docusaurus's native MDX imports.
|
|
9
|
+
*/
|
|
10
|
+
import { type BlockTransformer } from './index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Transform an include block into MDX JSX element
|
|
13
|
+
*/
|
|
14
|
+
declare const includeTransformer: BlockTransformer;
|
|
15
|
+
export { includeTransformer };
|
|
16
|
+
//# sourceMappingURL=include.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/include.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,gBAezB,CAAC;AAKF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Include block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% include "path/to/file.md" %} into GitBookInclude component
|
|
5
|
+
*
|
|
6
|
+
* Note: Full file inclusion at build time requires Docusaurus integration.
|
|
7
|
+
* This transformer renders a component that displays the include reference.
|
|
8
|
+
* For actual file inclusion, consider using Docusaurus's native MDX imports.
|
|
9
|
+
*/
|
|
10
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
11
|
+
import { registerTransformer } from './index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Transform an include block into MDX JSX element
|
|
14
|
+
*/
|
|
15
|
+
const includeTransformer = (block, _transformContent) => {
|
|
16
|
+
// Get path from positional argument or src attribute
|
|
17
|
+
const path = block.attributes._positional || block.attributes.src || '';
|
|
18
|
+
if (!path) {
|
|
19
|
+
console.warn('Include block missing path');
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const element = createMdxJsxElement('GitBookInclude', { src: path }, []);
|
|
23
|
+
return [element];
|
|
24
|
+
};
|
|
25
|
+
// Register transformer
|
|
26
|
+
registerTransformer('include', includeTransformer);
|
|
27
|
+
export { includeTransformer };
|
|
28
|
+
//# sourceMappingURL=include.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.js","sourceRoot":"","sources":["../../../src/remark/transformers/include.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,kBAAkB,GAAqB,CAC3C,KAAmB,EACnB,iBAAiD,EAC/B,EAAE;IACpB,qDAAqD;IACrD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC;IAExE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,mBAAmB,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzE,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,uBAAuB;AACvB,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block transformer registry
|
|
3
|
+
*/
|
|
4
|
+
import type { Content } from 'mdast';
|
|
5
|
+
import type { GitBookBlock } from '../../parser/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Transformer function type
|
|
8
|
+
* Takes a GitBook block and returns MDAST nodes
|
|
9
|
+
*/
|
|
10
|
+
export type BlockTransformer = (block: GitBookBlock, transformContent: (content: string) => Content[]) => Content[] | null;
|
|
11
|
+
/**
|
|
12
|
+
* Register a transformer for a block type
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerTransformer(blockName: string, transformer: BlockTransformer): void;
|
|
15
|
+
/**
|
|
16
|
+
* Get a transformer for a block type
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTransformer(blockName: string): BlockTransformer | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Check if a transformer exists for a block type
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasTransformer(blockName: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get all registered block names
|
|
25
|
+
*/
|
|
26
|
+
export declare function getRegisteredBlocks(): string[];
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,KAAK,EAAE,YAAY,EACnB,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,EAAE,KAC7C,OAAO,EAAE,GAAG,IAAI,CAAC;AAOtB;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,gBAAgB,GAC5B,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE9E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block transformer registry
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Registry of block transformers
|
|
6
|
+
*/
|
|
7
|
+
const transformers = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* Register a transformer for a block type
|
|
10
|
+
*/
|
|
11
|
+
export function registerTransformer(blockName, transformer) {
|
|
12
|
+
transformers.set(blockName, transformer);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get a transformer for a block type
|
|
16
|
+
*/
|
|
17
|
+
export function getTransformer(blockName) {
|
|
18
|
+
return transformers.get(blockName);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if a transformer exists for a block type
|
|
22
|
+
*/
|
|
23
|
+
export function hasTransformer(blockName) {
|
|
24
|
+
return transformers.has(blockName);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get all registered block names
|
|
28
|
+
*/
|
|
29
|
+
export function getRegisteredBlocks() {
|
|
30
|
+
return Array.from(transformers.keys());
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/remark/transformers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH;;GAEG;AACH,MAAM,YAAY,GAAkC,IAAI,GAAG,EAAE,CAAC;AAE9D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,WAA6B;IAE7B,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% openapi src="..." path="..." method="..." %}...{% endopenapi %}
|
|
5
|
+
* into GitBookOpenAPI component
|
|
6
|
+
*
|
|
7
|
+
* Note: This is a simplified implementation that displays API endpoint info.
|
|
8
|
+
* For full OpenAPI documentation, consider using dedicated plugins like
|
|
9
|
+
* docusaurus-openapi-docs.
|
|
10
|
+
*/
|
|
11
|
+
import { type BlockTransformer } from './index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Transform an openapi block into MDX JSX element
|
|
14
|
+
*/
|
|
15
|
+
declare const openapiTransformer: BlockTransformer;
|
|
16
|
+
export { openapiTransformer };
|
|
17
|
+
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,gBAoBzB,CAAC;AAKF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% openapi src="..." path="..." method="..." %}...{% endopenapi %}
|
|
5
|
+
* into GitBookOpenAPI component
|
|
6
|
+
*
|
|
7
|
+
* Note: This is a simplified implementation that displays API endpoint info.
|
|
8
|
+
* For full OpenAPI documentation, consider using dedicated plugins like
|
|
9
|
+
* docusaurus-openapi-docs.
|
|
10
|
+
*/
|
|
11
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
12
|
+
import { registerTransformer } from './index.js';
|
|
13
|
+
/**
|
|
14
|
+
* Transform an openapi block into MDX JSX element
|
|
15
|
+
*/
|
|
16
|
+
const openapiTransformer = (block, _transformContent) => {
|
|
17
|
+
const src = block.attributes.src || '';
|
|
18
|
+
const path = block.attributes.path || '';
|
|
19
|
+
const method = block.attributes.method || 'get';
|
|
20
|
+
if (!src || !path) {
|
|
21
|
+
console.warn('OpenAPI block missing src or path attribute');
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const element = createMdxJsxElement('GitBookOpenAPI', { src, path, method: method.toUpperCase() }, []);
|
|
25
|
+
return [element];
|
|
26
|
+
};
|
|
27
|
+
// Register transformer
|
|
28
|
+
registerTransformer('openapi', openapiTransformer);
|
|
29
|
+
export { openapiTransformer };
|
|
30
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../../src/remark/transformers/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,kBAAkB,GAAqB,CAC3C,KAAmB,EACnB,iBAAiD,EAC/B,EAAE;IACpB,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,IAAI,KAAK,CAAC;IAEhD,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,mBAAmB,CACjC,gBAAgB,EAChB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,EAC3C,EAAE,CACH,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,uBAAuB;AACvB,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stepper block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% stepper %}{% step %}content{% endstep %}{% endstepper %}
|
|
5
|
+
* into GitBookStepper/GitBookStep components
|
|
6
|
+
*/
|
|
7
|
+
import { type BlockTransformer } from './index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Transform a stepper block into MDX JSX elements
|
|
10
|
+
*/
|
|
11
|
+
declare const stepperTransformer: BlockTransformer;
|
|
12
|
+
/**
|
|
13
|
+
* Step blocks are handled as children of stepper
|
|
14
|
+
*/
|
|
15
|
+
declare const stepTransformer: BlockTransformer;
|
|
16
|
+
export { stepperTransformer, stepTransformer };
|
|
17
|
+
//# sourceMappingURL=stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/stepper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,gBA8BzB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,eAAe,EAAE,gBAStB,CAAC;AAMF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stepper block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% stepper %}{% step %}content{% endstep %}{% endstepper %}
|
|
5
|
+
* into GitBookStepper/GitBookStep components
|
|
6
|
+
*/
|
|
7
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
8
|
+
import { registerTransformer } from './index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Transform a stepper block into MDX JSX elements
|
|
11
|
+
*/
|
|
12
|
+
const stepperTransformer = (block, transformContent) => {
|
|
13
|
+
// Process child step blocks
|
|
14
|
+
const stepElements = [];
|
|
15
|
+
let stepNumber = 1;
|
|
16
|
+
for (const child of block.children) {
|
|
17
|
+
if (child.name === 'step') {
|
|
18
|
+
const stepContent = transformContent(child.content);
|
|
19
|
+
const stepElement = createMdxJsxElement('GitBookStep', { stepNumber: String(stepNumber) }, stepContent);
|
|
20
|
+
stepElements.push(stepElement);
|
|
21
|
+
stepNumber++;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (stepElements.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
// Create the stepper container
|
|
28
|
+
const element = createMdxJsxElement('GitBookStepper', {}, stepElements);
|
|
29
|
+
return [element];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Step blocks are handled as children of stepper
|
|
33
|
+
*/
|
|
34
|
+
const stepTransformer = (block, transformContent) => {
|
|
35
|
+
// Standalone step - render with step number 1
|
|
36
|
+
const children = transformContent(block.content);
|
|
37
|
+
const element = createMdxJsxElement('GitBookStep', { stepNumber: '1' }, children);
|
|
38
|
+
return [element];
|
|
39
|
+
};
|
|
40
|
+
// Register transformers
|
|
41
|
+
registerTransformer('stepper', stepperTransformer);
|
|
42
|
+
registerTransformer('step', stepTransformer);
|
|
43
|
+
export { stepperTransformer, stepTransformer };
|
|
44
|
+
//# sourceMappingURL=stepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../../src/remark/transformers/stepper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aA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,SAAS,EAAE,kBAAkB,CAAC,CAAC;AACnD,mBAAmB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% tabs %}{% tab title="X" %}content{% endtab %}{% endtabs %}
|
|
5
|
+
* into GitBookTabs/GitBookTab components
|
|
6
|
+
*/
|
|
7
|
+
import { type BlockTransformer } from './index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Transform a tabs block into MDX JSX elements
|
|
10
|
+
*/
|
|
11
|
+
declare const tabsTransformer: BlockTransformer;
|
|
12
|
+
/**
|
|
13
|
+
* Tab blocks are handled as children of tabs, not standalone
|
|
14
|
+
* This transformer is here in case a tab is found outside of tabs
|
|
15
|
+
*/
|
|
16
|
+
declare const tabTransformer: BlockTransformer;
|
|
17
|
+
export { tabsTransformer, tabTransformer };
|
|
18
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/tabs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,QAAA,MAAM,eAAe,EAAE,gBA6BtB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE,gBAWrB,CAAC;AAMF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% tabs %}{% tab title="X" %}content{% endtab %}{% endtabs %}
|
|
5
|
+
* into GitBookTabs/GitBookTab components
|
|
6
|
+
*/
|
|
7
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
8
|
+
import { registerTransformer } from './index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Transform a tabs block into MDX JSX elements
|
|
11
|
+
*/
|
|
12
|
+
const tabsTransformer = (block, transformContent) => {
|
|
13
|
+
// Process child tab blocks
|
|
14
|
+
const tabElements = [];
|
|
15
|
+
for (const child of block.children) {
|
|
16
|
+
if (child.name === 'tab') {
|
|
17
|
+
const title = child.attributes.title || 'Tab';
|
|
18
|
+
const tabContent = transformContent(child.content);
|
|
19
|
+
const tabElement = createMdxJsxElement('GitBookTab', { title }, tabContent);
|
|
20
|
+
tabElements.push(tabElement);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (tabElements.length === 0) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
// Create the tabs container
|
|
27
|
+
const element = createMdxJsxElement('GitBookTabs', {}, tabElements);
|
|
28
|
+
return [element];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Tab blocks are handled as children of tabs, not standalone
|
|
32
|
+
* This transformer is here in case a tab is found outside of tabs
|
|
33
|
+
*/
|
|
34
|
+
const tabTransformer = (block, transformContent) => {
|
|
35
|
+
// Standalone tab - just render as a div with title
|
|
36
|
+
const title = block.attributes.title || 'Tab';
|
|
37
|
+
const children = transformContent(block.content);
|
|
38
|
+
const element = createMdxJsxElement('GitBookTab', { title }, children);
|
|
39
|
+
return [element];
|
|
40
|
+
};
|
|
41
|
+
// Register transformers
|
|
42
|
+
registerTransformer('tabs', tabsTransformer);
|
|
43
|
+
registerTransformer('tab', tabTransformer);
|
|
44
|
+
export { tabsTransformer, tabTransformer };
|
|
45
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/remark/transformers/tabs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAA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AAC;AAEF,wBAAwB;AACxB,mBAAmB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAC7C,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Updates block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% updates %}{% update date="..." %}content{% endupdate %}{% endupdates %}
|
|
5
|
+
* into GitBookUpdates/GitBookUpdate components
|
|
6
|
+
*/
|
|
7
|
+
import { type BlockTransformer } from './index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Transform an updates block into MDX JSX elements
|
|
10
|
+
*/
|
|
11
|
+
declare const updatesTransformer: BlockTransformer;
|
|
12
|
+
/**
|
|
13
|
+
* Update blocks are handled as children of updates
|
|
14
|
+
*/
|
|
15
|
+
declare const updateTransformer: BlockTransformer;
|
|
16
|
+
export { updatesTransformer, updateTransformer };
|
|
17
|
+
//# sourceMappingURL=updates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../../src/remark/transformers/updates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,gBA+BzB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,iBAAiB,EAAE,gBASxB,CAAC;AAMF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Updates block transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms {% updates %}{% update date="..." %}content{% endupdate %}{% endupdates %}
|
|
5
|
+
* into GitBookUpdates/GitBookUpdate components
|
|
6
|
+
*/
|
|
7
|
+
import { createMdxJsxElement } from '../utils.js';
|
|
8
|
+
import { registerTransformer } from './index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Transform an updates block into MDX JSX elements
|
|
11
|
+
*/
|
|
12
|
+
const updatesTransformer = (block, transformContent) => {
|
|
13
|
+
const format = block.attributes.format || 'full';
|
|
14
|
+
// Process child update blocks
|
|
15
|
+
const updateElements = [];
|
|
16
|
+
for (const child of block.children) {
|
|
17
|
+
if (child.name === 'update') {
|
|
18
|
+
const date = child.attributes.date || '';
|
|
19
|
+
const updateContent = transformContent(child.content);
|
|
20
|
+
const updateElement = createMdxJsxElement('GitBookUpdate', { date }, updateContent);
|
|
21
|
+
updateElements.push(updateElement);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (updateElements.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
// Create the updates container
|
|
28
|
+
const element = createMdxJsxElement('GitBookUpdates', { format }, updateElements);
|
|
29
|
+
return [element];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Update blocks are handled as children of updates
|
|
33
|
+
*/
|
|
34
|
+
const updateTransformer = (block, transformContent) => {
|
|
35
|
+
const date = block.attributes.date || '';
|
|
36
|
+
const children = transformContent(block.content);
|
|
37
|
+
const element = createMdxJsxElement('GitBookUpdate', { date }, children);
|
|
38
|
+
return [element];
|
|
39
|
+
};
|
|
40
|
+
// Register transformers
|
|
41
|
+
registerTransformer('updates', updatesTransformer);
|
|
42
|
+
registerTransformer('update', updateTransformer);
|
|
43
|
+
export { updatesTransformer, updateTransformer };
|
|
44
|
+
//# sourceMappingURL=updates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../../../src/remark/transformers/updates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AAExE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,CAAC,CAAC;AAEF,wBAAwB;AACxB,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AACnD,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MDAST manipulation utilities
|
|
3
|
+
*/
|
|
4
|
+
import type { Content, Paragraph, Text } from 'mdast';
|
|
5
|
+
import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
6
|
+
/**
|
|
7
|
+
* Create an MDX JSX element node
|
|
8
|
+
*/
|
|
9
|
+
export declare function createMdxJsxElement(name: string, attributes: Record<string, string>, children?: Content[]): MdxJsxFlowElement;
|
|
10
|
+
/**
|
|
11
|
+
* Create a text node
|
|
12
|
+
*/
|
|
13
|
+
export declare function createTextNode(value: string): Text;
|
|
14
|
+
/**
|
|
15
|
+
* Create a paragraph node
|
|
16
|
+
*/
|
|
17
|
+
export declare function createParagraph(children: Content[]): Paragraph;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a node is a paragraph with text content
|
|
20
|
+
*/
|
|
21
|
+
export declare function isParagraphWithText(node: Content): node is Paragraph & {
|
|
22
|
+
children: [Text];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Get plain text content from a node (inline elements only).
|
|
26
|
+
* Used for checking whether a paragraph contains GitBook syntax.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTextContent(node: Content): string;
|
|
29
|
+
/**
|
|
30
|
+
* Serialize an MDAST node back to markdown text.
|
|
31
|
+
* Preserves code fences, heading markers, list markers, inline code, etc.
|
|
32
|
+
* so that re-parsing with remark-parse reproduces the proper AST structure.
|
|
33
|
+
*/
|
|
34
|
+
export declare function nodeToMarkdown(node: Content): string;
|
|
35
|
+
/**
|
|
36
|
+
* Check if text contains GitBook syntax
|
|
37
|
+
*/
|
|
38
|
+
export declare function containsGitBookSyntax(text: string): boolean;
|
|
39
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/remark/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,oBAAoB,CAAC;AAG7E;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,QAAQ,GAAE,OAAO,EAAO,GACvB,iBAAiB,CAkBnB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS,CAK9D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,SAAS,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAA;CAAE,CAM1C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAQpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAiEpD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|