@graphql-markdown/docusaurus 1.28.0 → 1.29.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/mdx/category.d.ts +2 -0
- package/dist/mdx/category.js +31 -0
- package/dist/mdx/index.d.ts +3 -5
- package/dist/mdx/index.js +6 -2
- package/package.json +5 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateIndexMetafile = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
6
|
+
const CATEGORY_YAML = "_category_.yml";
|
|
7
|
+
var SidebarPosition;
|
|
8
|
+
(function (SidebarPosition) {
|
|
9
|
+
SidebarPosition[SidebarPosition["FIRST"] = 1] = "FIRST";
|
|
10
|
+
SidebarPosition[SidebarPosition["LAST"] = 999] = "LAST";
|
|
11
|
+
})(SidebarPosition || (SidebarPosition = {}));
|
|
12
|
+
const generateIndexMetafile = async (dirPath, category, options) => {
|
|
13
|
+
const filePath = (0, node_path_1.join)(dirPath, CATEGORY_YAML);
|
|
14
|
+
if (await (0, utils_1.fileExists)(filePath)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const label = (0, utils_1.startCase)(category);
|
|
18
|
+
const link = options?.index !== true
|
|
19
|
+
? "null"
|
|
20
|
+
: `\n type: generated-index\n title: '${label} overview'`;
|
|
21
|
+
const className = typeof options?.styleClass === "string"
|
|
22
|
+
? `className: ${options.styleClass}\n`
|
|
23
|
+
: "";
|
|
24
|
+
const position = typeof options?.sidebarPosition === "number"
|
|
25
|
+
? options.sidebarPosition
|
|
26
|
+
: SidebarPosition.FIRST;
|
|
27
|
+
const content = `label: ${label}\nposition: ${position}\n${className}link: ${link}\ncollapsible: ${options?.collapsible ?? true}\ncollapsed: ${options?.collapsed ?? true}\n`;
|
|
28
|
+
await (0, utils_1.ensureDir)(dirPath);
|
|
29
|
+
await (0, utils_1.saveFile)(filePath, content);
|
|
30
|
+
};
|
|
31
|
+
exports.generateIndexMetafile = generateIndexMetafile;
|
package/dist/mdx/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { AdmonitionType, Badge, Maybe, MDXString, MetaOptions, TypeLink } from "@graphql-markdown/types";
|
|
1
|
+
import type { AdmonitionType, Badge, CollapsibleOption, Maybe, MDXString, MetaOptions, TypeLink } from "@graphql-markdown/types";
|
|
2
2
|
export { mdxDeclaration } from "./components";
|
|
3
|
+
export { generateIndexMetafile } from "./category";
|
|
3
4
|
export declare const formatMDXBadge: ({ text, classname }: Badge) => MDXString;
|
|
4
5
|
export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, meta: Maybe<MetaOptions>) => MDXString;
|
|
5
6
|
export declare const formatMDXBullet: (text?: string) => MDXString;
|
|
6
|
-
export declare const formatMDXDetails: ({ dataOpen, dataClose, }:
|
|
7
|
-
dataOpen: Maybe<string>;
|
|
8
|
-
dataClose: Maybe<string>;
|
|
9
|
-
}) => MDXString;
|
|
7
|
+
export declare const formatMDXDetails: ({ dataOpen, dataClose, }: CollapsibleOption) => MDXString;
|
|
10
8
|
export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
|
|
11
9
|
export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
|
|
12
10
|
export declare const formatMDXLink: ({ text, url }: TypeLink) => TypeLink;
|
package/dist/mdx/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatMDXLink = exports.formatMDXNameEntity = exports.formatMDXSpecifiedByLink = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxDeclaration = void 0;
|
|
3
|
+
exports.formatMDXLink = exports.formatMDXNameEntity = exports.formatMDXSpecifiedByLink = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.generateIndexMetafile = exports.mdxDeclaration = void 0;
|
|
4
4
|
const MARKDOWN_EOL = "\n";
|
|
5
5
|
const MARKDOWN_EOP = `${MARKDOWN_EOL.repeat(2)}`;
|
|
6
6
|
const LINK_MDX_EXTENSION = ".mdx";
|
|
7
|
+
const DEFAULT_CSS_CLASSNAME = "badge--secondary";
|
|
7
8
|
var components_1 = require("./components");
|
|
8
9
|
Object.defineProperty(exports, "mdxDeclaration", { enumerable: true, get: function () { return components_1.mdxDeclaration; } });
|
|
10
|
+
var category_1 = require("./category");
|
|
11
|
+
Object.defineProperty(exports, "generateIndexMetafile", { enumerable: true, get: function () { return category_1.generateIndexMetafile; } });
|
|
9
12
|
const formatMDXBadge = ({ text, classname }) => {
|
|
10
|
-
|
|
13
|
+
const style = typeof classname === "string" ? `badge--${classname.toLowerCase()}` : "";
|
|
14
|
+
return `<Badge class="badge ${DEFAULT_CSS_CLASSNAME} ${style}" text="${text}"/>`;
|
|
11
15
|
};
|
|
12
16
|
exports.formatMDXBadge = formatMDXBadge;
|
|
13
17
|
const formatMDXAdmonition = ({ text, title, type }, meta) => {
|
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.
|
|
8
|
+
"version": "1.29.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -65,12 +65,14 @@
|
|
|
65
65
|
"docs": "typedoc"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@graphql-markdown/cli": "^0.
|
|
68
|
+
"@graphql-markdown/cli": "^0.3.0",
|
|
69
|
+
"@graphql-markdown/logger": "^1.0.5",
|
|
70
|
+
"@graphql-markdown/utils": "^1.8.0",
|
|
69
71
|
"@docusaurus/utils": ">=3.2.0"
|
|
70
72
|
},
|
|
71
73
|
"devDependencies": {
|
|
72
74
|
"@docusaurus/types": "^3.7.0",
|
|
73
|
-
"@graphql-markdown/types": "^1.
|
|
75
|
+
"@graphql-markdown/types": "^1.7.0"
|
|
74
76
|
},
|
|
75
77
|
"peerDependencies": {
|
|
76
78
|
"@docusaurus/logger": "*"
|