@graphql-markdown/docusaurus 1.29.0 → 1.29.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/README.md +3 -5
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -0
- package/dist/mdx/category.d.ts +4 -0
- package/dist/mdx/category.js +4 -0
- package/dist/mdx/components.d.ts +4 -0
- package/dist/mdx/components.js +4 -0
- package/dist/mdx/index.d.ts +35 -0
- package/dist/mdx/index.js +37 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@graphql-markdown/docusaurus)
|
|
4
4
|
[](https://raw.githubusercontent.com/graphql-markdown/graphql-markdown/main/LICENSE)
|
|
5
5
|
[](https://sonarcloud.io/summary/new_code?id=graphql-markdown_docusaurus)
|
|
6
|
-
<!--
|
|
7
6
|
[](https://sonarcloud.io/summary/new_code?id=graphql-markdown_docusaurus)
|
|
8
|
-
[](https://dashboard.stryker-mutator.io/reports/github.com/graphql-markdown/graphql-markdown/main?module=docusaurus)
|
|
10
8
|
|
|
11
9
|
**Docusaurus** [docs feature](https://docusaurus.io/docs/docs-introduction) plugin for generating **Markdown documentation** from a **GraphQL schema**.
|
|
12
10
|
|
|
@@ -16,7 +14,7 @@
|
|
|
16
14
|
npm init docusaurus my-website https://github.com/graphql-markdown/template.git
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
> _If you already have an existing Docusaurus installation, then see the [documentation](https://graphql-markdown.dev/docs/get-started) for alternative installation._
|
|
17
|
+
> _If you already have an existing Docusaurus installation, then see the [documentation](https://graphql-markdown.dev/docs/get-started/#existing-docusaurus-site) for an alternative installation._
|
|
20
18
|
|
|
21
19
|
## Usage
|
|
22
20
|
|
|
@@ -40,4 +38,4 @@ See [documentation troubleshooting](https://graphql-markdown.dev/docs/troublesho
|
|
|
40
38
|
|
|
41
39
|
GraphQL-Markdown packages are 100% free and open-source, under the [MIT license](https://github.com/graphql-markdown/graphql-markdown/blob/main/LICENSE).
|
|
42
40
|
|
|
43
|
-
This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/graphql-markdown/graphql-markdown) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
|
|
41
|
+
This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/graphql-markdown/graphql-markdown) to thank us for our work. By contributing to the Treeware forest, you’ll be creating employment for local families and restoring wildlife habitats.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { LoadContext, Plugin, PluginOptions } from "@docusaurus/types";
|
|
2
2
|
import type { GraphQLMarkdownCliOptions } from "@graphql-markdown/types";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
3
6
|
export default function pluginGraphQLDocGenerator(_: LoadContext, options: GraphQLMarkdownCliOptions & Partial<PluginOptions>): Promise<Plugin>;
|
package/dist/index.js
CHANGED
|
@@ -10,16 +10,30 @@ const logger_1 = __importDefault(require("@graphql-markdown/logger"));
|
|
|
10
10
|
const NAME = "docusaurus-graphql-doc-generator";
|
|
11
11
|
const LOGGER_MODULE = "@docusaurus/logger";
|
|
12
12
|
const MDX_PACKAGE = "@graphql-markdown/docusaurus/mdx";
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
13
16
|
async function pluginGraphQLDocGenerator(_, options) {
|
|
14
17
|
await (0, logger_1.default)(LOGGER_MODULE);
|
|
15
18
|
return {
|
|
16
19
|
name: NAME,
|
|
20
|
+
/**
|
|
21
|
+
* @experimental
|
|
22
|
+
*/
|
|
17
23
|
async loadContent() {
|
|
18
24
|
if (options.runOnBuild !== true) {
|
|
19
25
|
return;
|
|
20
26
|
}
|
|
21
27
|
await (0, cli_1.runGraphQLMarkdown)(options, {}, LOGGER_MODULE);
|
|
22
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* Extends Docusaurus CLI with GraphQL Documentation generator command.
|
|
31
|
+
* This method adds a custom command to generate GraphQL documentation
|
|
32
|
+
* using the configured options.
|
|
33
|
+
*
|
|
34
|
+
* @param cli - The Docusaurus CLI instance to extend
|
|
35
|
+
* @returns void
|
|
36
|
+
*/
|
|
23
37
|
extendCli(cli) {
|
|
24
38
|
cli.addCommand((0, cli_1.getGraphQLMarkdownCli)({
|
|
25
39
|
...options,
|
package/dist/mdx/category.d.ts
CHANGED
package/dist/mdx/category.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module mdx
|
|
4
|
+
* This module provides utilities for generating MDX index files in Docusaurus format.
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.generateIndexMetafile = void 0;
|
|
4
8
|
const node_path_1 = require("node:path");
|
package/dist/mdx/components.d.ts
CHANGED
package/dist/mdx/components.js
CHANGED
package/dist/mdx/index.d.ts
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module mdx
|
|
3
|
+
* This module provides utilities for generating MDX content in Docusaurus format.
|
|
4
|
+
* It includes functions for creating badges, admonitions, bullet points, collapsible sections,
|
|
5
|
+
* specification links, and other MDX-specific formatting for GraphQL documentation.
|
|
6
|
+
*
|
|
7
|
+
* @primaryExport
|
|
8
|
+
*/
|
|
1
9
|
import type { AdmonitionType, Badge, CollapsibleOption, Maybe, MDXString, MetaOptions, TypeLink } from "@graphql-markdown/types";
|
|
2
10
|
export { mdxDeclaration } from "./components";
|
|
3
11
|
export { generateIndexMetafile } from "./category";
|
|
4
12
|
export declare const formatMDXBadge: ({ text, classname }: Badge) => MDXString;
|
|
13
|
+
/**
|
|
14
|
+
* Formats an admonition block in MDX format
|
|
15
|
+
* @param param - The admonition configuration object
|
|
16
|
+
* @param meta - Optional metadata for generator configuration
|
|
17
|
+
* @returns Formatted MDX string for the admonition
|
|
18
|
+
*/
|
|
5
19
|
export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, meta: Maybe<MetaOptions>) => MDXString;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a bullet point element in MDX format
|
|
22
|
+
* @param text - Optional text to append after the bullet point
|
|
23
|
+
* @returns Formatted MDX string for the bullet point
|
|
24
|
+
*/
|
|
6
25
|
export declare const formatMDXBullet: (text?: string) => MDXString;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a collapsible details section in MDX format
|
|
28
|
+
* @param param - The collapsible section configuration
|
|
29
|
+
* @returns Formatted MDX string for the collapsible section
|
|
30
|
+
*/
|
|
7
31
|
export declare const formatMDXDetails: ({ dataOpen, dataClose, }: CollapsibleOption) => MDXString;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a link to the specification documentation
|
|
34
|
+
* @param url - The URL to the specification
|
|
35
|
+
* @returns Formatted MDX string for the specification link
|
|
36
|
+
*/
|
|
8
37
|
export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
|
|
38
|
+
/**
|
|
39
|
+
* Formats a name entity with optional parent type
|
|
40
|
+
* @param name - The name to format
|
|
41
|
+
* @param parentType - Optional parent type to prefix the name
|
|
42
|
+
* @returns Formatted MDX string for the name entity
|
|
43
|
+
*/
|
|
9
44
|
export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
|
|
10
45
|
export declare const formatMDXLink: ({ text, url }: TypeLink) => TypeLink;
|
package/dist/mdx/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module mdx
|
|
4
|
+
* This module provides utilities for generating MDX content in Docusaurus format.
|
|
5
|
+
* It includes functions for creating badges, admonitions, bullet points, collapsible sections,
|
|
6
|
+
* specification links, and other MDX-specific formatting for GraphQL documentation.
|
|
7
|
+
*
|
|
8
|
+
* @primaryExport
|
|
9
|
+
*/
|
|
2
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
11
|
exports.formatMDXLink = exports.formatMDXNameEntity = exports.formatMDXSpecifiedByLink = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.generateIndexMetafile = exports.mdxDeclaration = void 0;
|
|
12
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
4
13
|
const MARKDOWN_EOL = "\n";
|
|
5
14
|
const MARKDOWN_EOP = `${MARKDOWN_EOL.repeat(2)}`;
|
|
6
15
|
const LINK_MDX_EXTENSION = ".mdx";
|
|
@@ -14,6 +23,12 @@ const formatMDXBadge = ({ text, classname }) => {
|
|
|
14
23
|
return `<Badge class="badge ${DEFAULT_CSS_CLASSNAME} ${style}" text="${text}"/>`;
|
|
15
24
|
};
|
|
16
25
|
exports.formatMDXBadge = formatMDXBadge;
|
|
26
|
+
/**
|
|
27
|
+
* Formats an admonition block in MDX format
|
|
28
|
+
* @param param - The admonition configuration object
|
|
29
|
+
* @param meta - Optional metadata for generator configuration
|
|
30
|
+
* @returns Formatted MDX string for the admonition
|
|
31
|
+
*/
|
|
17
32
|
const formatMDXAdmonition = ({ text, title, type }, meta) => {
|
|
18
33
|
const isDocusaurus = meta?.generatorFrameworkName === "docusaurus";
|
|
19
34
|
if (isDocusaurus && meta.generatorFrameworkVersion?.startsWith("2")) {
|
|
@@ -23,21 +38,42 @@ const formatMDXAdmonition = ({ text, title, type }, meta) => {
|
|
|
23
38
|
return `${MARKDOWN_EOP}:::${type}[${title}]${text}:::`;
|
|
24
39
|
};
|
|
25
40
|
exports.formatMDXAdmonition = formatMDXAdmonition;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a bullet point element in MDX format
|
|
43
|
+
* @param text - Optional text to append after the bullet point
|
|
44
|
+
* @returns Formatted MDX string for the bullet point
|
|
45
|
+
*/
|
|
26
46
|
const formatMDXBullet = (text = "") => {
|
|
27
47
|
return `<Bullet />${text}`;
|
|
28
48
|
};
|
|
29
49
|
exports.formatMDXBullet = formatMDXBullet;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a collapsible details section in MDX format
|
|
52
|
+
* @param param - The collapsible section configuration
|
|
53
|
+
* @returns Formatted MDX string for the collapsible section
|
|
54
|
+
*/
|
|
30
55
|
const formatMDXDetails = ({ dataOpen, dataClose, }) => {
|
|
31
56
|
return `${MARKDOWN_EOP}<Details dataOpen="Hide ${dataOpen}" dataClose="Show ${dataClose}">${MARKDOWN_EOP}\r${MARKDOWN_EOP}</Details>${MARKDOWN_EOP}`;
|
|
32
57
|
};
|
|
33
58
|
exports.formatMDXDetails = formatMDXDetails;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a link to the specification documentation
|
|
61
|
+
* @param url - The URL to the specification
|
|
62
|
+
* @returns Formatted MDX string for the specification link
|
|
63
|
+
*/
|
|
34
64
|
const formatMDXSpecifiedByLink = (url) => {
|
|
35
65
|
return `<SpecifiedBy url="${url}"/>`;
|
|
36
66
|
};
|
|
37
67
|
exports.formatMDXSpecifiedByLink = formatMDXSpecifiedByLink;
|
|
68
|
+
/**
|
|
69
|
+
* Formats a name entity with optional parent type
|
|
70
|
+
* @param name - The name to format
|
|
71
|
+
* @param parentType - Optional parent type to prefix the name
|
|
72
|
+
* @returns Formatted MDX string for the name entity
|
|
73
|
+
*/
|
|
38
74
|
const formatMDXNameEntity = (name, parentType) => {
|
|
39
75
|
const parentName = parentType ? `${parentType}.` : "";
|
|
40
|
-
return `<code style={{ fontWeight: 'normal' }}>${parentName}<b>${name}</b></code>`;
|
|
76
|
+
return `<code style={{ fontWeight: 'normal' }}>${(0, utils_1.escapeMDX)(parentName)}<b>${(0, utils_1.escapeMDX)(name)}</b></code>`;
|
|
41
77
|
};
|
|
42
78
|
exports.formatMDXNameEntity = formatMDXNameEntity;
|
|
43
79
|
const formatMDXLink = ({ text, url }) => {
|
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.29.
|
|
8
|
+
"version": "1.29.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"docs": "typedoc"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@graphql-markdown/cli": "^0.3.
|
|
68
|
+
"@graphql-markdown/cli": "^0.3.1",
|
|
69
69
|
"@graphql-markdown/logger": "^1.0.5",
|
|
70
|
-
"@graphql-markdown/utils": "^1.8.
|
|
70
|
+
"@graphql-markdown/utils": "^1.8.1",
|
|
71
71
|
"@docusaurus/utils": ">=3.2.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|