@graphql-markdown/docusaurus 1.31.0 → 1.31.1
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/mdx/category.d.ts +5 -3
- package/dist/mdx/category.d.ts.map +1 -1
- package/dist/mdx/category.js +1 -1
- package/dist/mdx/index.d.ts +40 -2
- package/dist/mdx/index.d.ts.map +1 -1
- package/dist/mdx/index.js +57 -6
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ import type { GraphQLMarkdownCliOptions } from "@graphql-markdown/types";
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
export default function pluginGraphQLDocGenerator(_: LoadContext, options: GraphQLMarkdownCliOptions & Partial<PluginOptions>): Promise<Plugin>;
|
|
7
|
+
export { createMDXFormatter } from "./mdx";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAczE;;GAEG;AACH,wBAA8B,yBAAyB,CACrD,CAAC,EAAE,WAAW,EACd,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,GAC1D,OAAO,CAAC,MAAM,CAAC,CAyCjB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAczE;;GAEG;AACH,wBAA8B,yBAAyB,CACrD,CAAC,EAAE,WAAW,EACd,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,GAC1D,OAAO,CAAC,MAAM,CAAC,CAyCjB;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createMDXFormatter = void 0;
|
|
6
7
|
exports.default = pluginGraphQLDocGenerator;
|
|
7
8
|
const utils_1 = require("@docusaurus/utils");
|
|
8
9
|
const cli_1 = require("@graphql-markdown/cli");
|
|
@@ -46,3 +47,5 @@ async function pluginGraphQLDocGenerator(_, options) {
|
|
|
46
47
|
},
|
|
47
48
|
};
|
|
48
49
|
}
|
|
50
|
+
const mdx_1 = require("./mdx");
|
|
51
|
+
Object.defineProperty(exports, "createMDXFormatter", { enumerable: true, get: function () { return mdx_1.createMDXFormatter; } });
|
package/dist/mdx/category.d.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* This module provides utilities for generating MDX index files in Docusaurus format.
|
|
4
4
|
*/
|
|
5
5
|
export declare const beforeGenerateIndexMetafileHook: (event: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
data: {
|
|
7
|
+
dirPath: string;
|
|
8
|
+
category: string;
|
|
9
|
+
options?: Record<string, unknown> | undefined;
|
|
10
|
+
};
|
|
9
11
|
}) => Promise<void>;
|
|
10
12
|
//# sourceMappingURL=category.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.d.ts","sourceRoot":"","sources":["../../src/mdx/category.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,eAAO,MAAM,+BAA+B
|
|
1
|
+
{"version":3,"file":"category.d.ts","sourceRoot":"","sources":["../../src/mdx/category.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,eAAO,MAAM,+BAA+B;;;;;;mBAiC3C,CAAC"}
|
package/dist/mdx/category.js
CHANGED
|
@@ -14,7 +14,7 @@ var SidebarPosition;
|
|
|
14
14
|
SidebarPosition[SidebarPosition["LAST"] = 999] = "LAST";
|
|
15
15
|
})(SidebarPosition || (SidebarPosition = {}));
|
|
16
16
|
const beforeGenerateIndexMetafileHook = async (event) => {
|
|
17
|
-
const { dirPath, category, options } = event;
|
|
17
|
+
const { dirPath, category, options } = event.data;
|
|
18
18
|
const filePath = (0, node_path_1.join)(dirPath, CATEGORY_YAML);
|
|
19
19
|
if (await (0, utils_1.fileExists)(filePath)) {
|
|
20
20
|
return;
|
package/dist/mdx/index.d.ts
CHANGED
|
@@ -6,9 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @primaryExport
|
|
8
8
|
*/
|
|
9
|
-
import type { AdmonitionType, Badge, CollapsibleOption, Maybe, MDXString,
|
|
9
|
+
import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
|
|
10
10
|
export { mdxDeclaration } from "./components";
|
|
11
11
|
export { beforeGenerateIndexMetafileHook } from "./category";
|
|
12
|
+
/**
|
|
13
|
+
* Formats a Badge inline-block in MDX format
|
|
14
|
+
* @param param - The badge configuration object
|
|
15
|
+
* @returns Formatted MDX string for the badge
|
|
16
|
+
*/
|
|
12
17
|
export declare const formatMDXBadge: ({ text, classname }: Badge) => MDXString;
|
|
13
18
|
/**
|
|
14
19
|
* Formats an admonition block in MDX format
|
|
@@ -16,7 +21,7 @@ export declare const formatMDXBadge: ({ text, classname }: Badge) => MDXString;
|
|
|
16
21
|
* @param meta - Optional metadata for generator configuration
|
|
17
22
|
* @returns Formatted MDX string for the admonition
|
|
18
23
|
*/
|
|
19
|
-
export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, meta: Maybe<
|
|
24
|
+
export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, meta: Maybe<MetaInfo>) => MDXString;
|
|
20
25
|
/**
|
|
21
26
|
* Creates a bullet point element in MDX format
|
|
22
27
|
* @param text - Optional text to append after the bullet point
|
|
@@ -42,5 +47,38 @@ export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
|
|
|
42
47
|
* @returns Formatted MDX string for the name entity
|
|
43
48
|
*/
|
|
44
49
|
export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
|
|
50
|
+
/**
|
|
51
|
+
* Formats a link in MDX format
|
|
52
|
+
* @param param - The link configuration object
|
|
53
|
+
* @returns Formatted MDX link object
|
|
54
|
+
*/
|
|
45
55
|
export declare const formatMDXLink: ({ text, url }: TypeLink) => TypeLink;
|
|
56
|
+
/**
|
|
57
|
+
* Default frontmatter formatter for MDX.
|
|
58
|
+
*
|
|
59
|
+
* @param _props - The front matter options (unused)
|
|
60
|
+
* @param formatted - The formatted front matter as an array of strings
|
|
61
|
+
* @returns Formatted MDX string for the front matter
|
|
62
|
+
*/
|
|
63
|
+
export declare const formatMDXFrontmatter: (_props: Maybe<FrontMatterOptions>, formatted: Maybe<string[]>) => MDXString;
|
|
64
|
+
/**
|
|
65
|
+
* Creates an MDX formatter for Docusaurus documentation.
|
|
66
|
+
*
|
|
67
|
+
* The MDX formatter produces React component-based markup compatible
|
|
68
|
+
* with Docusaurus MDX rendering. It uses components like `<Badge>`,
|
|
69
|
+
* `<Bullet>`, `<Details>`, and `<SpecifiedBy>`.
|
|
70
|
+
*
|
|
71
|
+
* @param meta - Optional metadata for framework-specific formatting
|
|
72
|
+
* @returns A complete Formatter implementation for MDX output
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* import { createMDXFormatter } from '@graphql-markdown/docusaurus';
|
|
77
|
+
*
|
|
78
|
+
* const formatter = createMDXFormatter({ generatorFrameworkName: 'docusaurus' });
|
|
79
|
+
* const badge = formatter.formatMDXBadge({ text: 'Required' });
|
|
80
|
+
* // '<Badge class="badge badge--secondary " text="Required"/>'
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare const createMDXFormatter: (meta?: Maybe<MetaInfo>) => Formatter;
|
|
46
84
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mdx/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,KAAK,EACL,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAWjC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,cAAc,2CAI1B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,6EAU/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,8BAE3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,4DAK5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,4BAEpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,yDAM/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,uCAKzB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,8EAShC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kBAAkB,uCAU7B,CAAC"}
|
package/dist/mdx/index.js
CHANGED
|
@@ -8,16 +8,19 @@
|
|
|
8
8
|
* @primaryExport
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.formatMDXLink = exports.formatMDXNameEntity = exports.formatMDXSpecifiedByLink = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.beforeGenerateIndexMetafileHook = exports.mdxDeclaration = void 0;
|
|
11
|
+
exports.createMDXFormatter = exports.formatMDXFrontmatter = exports.formatMDXLink = exports.formatMDXNameEntity = exports.formatMDXSpecifiedByLink = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.beforeGenerateIndexMetafileHook = exports.mdxDeclaration = void 0;
|
|
12
12
|
const utils_1 = require("@graphql-markdown/utils");
|
|
13
|
-
const MARKDOWN_EOL = "\n";
|
|
14
|
-
const MARKDOWN_EOP = `${MARKDOWN_EOL.repeat(2)}`;
|
|
15
13
|
const LINK_MDX_EXTENSION = ".mdx";
|
|
16
14
|
const DEFAULT_CSS_CLASSNAME = "badge--secondary";
|
|
17
15
|
const components_1 = require("./components");
|
|
18
16
|
Object.defineProperty(exports, "mdxDeclaration", { enumerable: true, get: function () { return components_1.mdxDeclaration; } });
|
|
19
17
|
const category_1 = require("./category");
|
|
20
18
|
Object.defineProperty(exports, "beforeGenerateIndexMetafileHook", { enumerable: true, get: function () { return category_1.beforeGenerateIndexMetafileHook; } });
|
|
19
|
+
/**
|
|
20
|
+
* Formats a Badge inline-block in MDX format
|
|
21
|
+
* @param param - The badge configuration object
|
|
22
|
+
* @returns Formatted MDX string for the badge
|
|
23
|
+
*/
|
|
21
24
|
const formatMDXBadge = ({ text, classname }) => {
|
|
22
25
|
const style = typeof classname === "string" ? `badge--${classname.toLowerCase()}` : "";
|
|
23
26
|
return `<Badge class="badge ${DEFAULT_CSS_CLASSNAME} ${style}" text="${text}"/>`;
|
|
@@ -33,9 +36,9 @@ const formatMDXAdmonition = ({ text, title, type }, meta) => {
|
|
|
33
36
|
const isDocusaurus = meta?.generatorFrameworkName === "docusaurus";
|
|
34
37
|
if (isDocusaurus && meta.generatorFrameworkVersion?.startsWith("2")) {
|
|
35
38
|
const oldType = type === "warning" ? "caution" : type;
|
|
36
|
-
return `${MARKDOWN_EOP}:::${oldType} ${title}${text}:::`;
|
|
39
|
+
return `${utils_1.MARKDOWN_EOP}:::${oldType} ${title}${text}:::`;
|
|
37
40
|
}
|
|
38
|
-
return `${MARKDOWN_EOP}:::${type}[${title}]${text}:::`;
|
|
41
|
+
return `${utils_1.MARKDOWN_EOP}:::${type}[${title}]${text}:::`;
|
|
39
42
|
};
|
|
40
43
|
exports.formatMDXAdmonition = formatMDXAdmonition;
|
|
41
44
|
/**
|
|
@@ -53,7 +56,7 @@ exports.formatMDXBullet = formatMDXBullet;
|
|
|
53
56
|
* @returns Formatted MDX string for the collapsible section
|
|
54
57
|
*/
|
|
55
58
|
const formatMDXDetails = ({ dataOpen, dataClose, }) => {
|
|
56
|
-
return `${MARKDOWN_EOP}<Details dataOpen="Hide ${dataOpen}" dataClose="Show ${dataClose}">${MARKDOWN_EOP}\r${MARKDOWN_EOP}</Details>${MARKDOWN_EOP}`;
|
|
59
|
+
return `${utils_1.MARKDOWN_EOP}<Details dataOpen="Hide ${dataOpen}" dataClose="Show ${dataClose}">${utils_1.MARKDOWN_EOP}\r${utils_1.MARKDOWN_EOP}</Details>${utils_1.MARKDOWN_EOP}`;
|
|
57
60
|
};
|
|
58
61
|
exports.formatMDXDetails = formatMDXDetails;
|
|
59
62
|
/**
|
|
@@ -76,6 +79,11 @@ const formatMDXNameEntity = (name, parentType) => {
|
|
|
76
79
|
return `<code style={{ fontWeight: 'normal' }}>${(0, utils_1.escapeMDX)(parentName)}<b>${(0, utils_1.escapeMDX)(name)}</b></code>`;
|
|
77
80
|
};
|
|
78
81
|
exports.formatMDXNameEntity = formatMDXNameEntity;
|
|
82
|
+
/**
|
|
83
|
+
* Formats a link in MDX format
|
|
84
|
+
* @param param - The link configuration object
|
|
85
|
+
* @returns Formatted MDX link object
|
|
86
|
+
*/
|
|
79
87
|
const formatMDXLink = ({ text, url }) => {
|
|
80
88
|
return {
|
|
81
89
|
text,
|
|
@@ -83,3 +91,46 @@ const formatMDXLink = ({ text, url }) => {
|
|
|
83
91
|
};
|
|
84
92
|
};
|
|
85
93
|
exports.formatMDXLink = formatMDXLink;
|
|
94
|
+
/**
|
|
95
|
+
* Default frontmatter formatter for MDX.
|
|
96
|
+
*
|
|
97
|
+
* @param _props - The front matter options (unused)
|
|
98
|
+
* @param formatted - The formatted front matter as an array of strings
|
|
99
|
+
* @returns Formatted MDX string for the front matter
|
|
100
|
+
*/
|
|
101
|
+
const formatMDXFrontmatter = (_props, formatted) => {
|
|
102
|
+
return formatted
|
|
103
|
+
? [utils_1.FRONT_MATTER_DELIMITER, ...formatted, utils_1.FRONT_MATTER_DELIMITER].join(utils_1.MARKDOWN_EOL)
|
|
104
|
+
: "";
|
|
105
|
+
};
|
|
106
|
+
exports.formatMDXFrontmatter = formatMDXFrontmatter;
|
|
107
|
+
/**
|
|
108
|
+
* Creates an MDX formatter for Docusaurus documentation.
|
|
109
|
+
*
|
|
110
|
+
* The MDX formatter produces React component-based markup compatible
|
|
111
|
+
* with Docusaurus MDX rendering. It uses components like `<Badge>`,
|
|
112
|
+
* `<Bullet>`, `<Details>`, and `<SpecifiedBy>`.
|
|
113
|
+
*
|
|
114
|
+
* @param meta - Optional metadata for framework-specific formatting
|
|
115
|
+
* @returns A complete Formatter implementation for MDX output
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* import { createMDXFormatter } from '@graphql-markdown/docusaurus';
|
|
120
|
+
*
|
|
121
|
+
* const formatter = createMDXFormatter({ generatorFrameworkName: 'docusaurus' });
|
|
122
|
+
* const badge = formatter.formatMDXBadge({ text: 'Required' });
|
|
123
|
+
* // '<Badge class="badge badge--secondary " text="Required"/>'
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
const createMDXFormatter = (meta) => ({
|
|
127
|
+
formatMDXBadge: exports.formatMDXBadge,
|
|
128
|
+
formatMDXAdmonition: (admonition, _meta) => (0, exports.formatMDXAdmonition)(admonition, meta ?? _meta),
|
|
129
|
+
formatMDXBullet: exports.formatMDXBullet,
|
|
130
|
+
formatMDXDetails: exports.formatMDXDetails,
|
|
131
|
+
formatMDXFrontmatter: exports.formatMDXFrontmatter,
|
|
132
|
+
formatMDXLink: exports.formatMDXLink,
|
|
133
|
+
formatMDXNameEntity: exports.formatMDXNameEntity,
|
|
134
|
+
formatMDXSpecifiedByLink: exports.formatMDXSpecifiedByLink,
|
|
135
|
+
});
|
|
136
|
+
exports.createMDXFormatter = createMDXFormatter;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/graphql-markdown/graphql-markdown/issues"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.31.
|
|
8
|
+
"version": "1.31.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
"build": "tsgo --build"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@graphql-markdown/cli": "
|
|
68
|
-
"@graphql-markdown/logger": "
|
|
69
|
-
"@graphql-markdown/utils": "
|
|
70
|
-
"@docusaurus/utils": "
|
|
67
|
+
"@graphql-markdown/cli": "^0.5.0",
|
|
68
|
+
"@graphql-markdown/logger": "^1.0.5",
|
|
69
|
+
"@graphql-markdown/utils": "^1.9.1",
|
|
70
|
+
"@docusaurus/utils": ">=3.9.2"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@docusaurus/types": "
|
|
74
|
-
"@graphql-markdown/types": "
|
|
73
|
+
"@docusaurus/types": "^3.7.0",
|
|
74
|
+
"@graphql-markdown/types": "^1.9.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@docusaurus/logger": "
|
|
77
|
+
"@docusaurus/logger": "*"
|
|
78
78
|
},
|
|
79
79
|
"directories": {
|
|
80
80
|
"test": "tests"
|