@graphql-markdown/formatters 1.0.0 → 1.0.2

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/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.0.0",
8
+ "version": "1.0.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -35,197 +35,197 @@
35
35
  "exports": {
36
36
  ".": {
37
37
  "require": {
38
- "types": "./dist/index.d.ts",
39
- "default": "./dist/index.js"
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
40
+ },
41
+ "import": {
42
+ "types": "./dist/index.d.ts",
43
+ "default": "./dist/index.js"
44
+ },
45
+ "default": {
46
+ "types": "./dist/index.d.ts",
47
+ "default": "./dist/index.js"
48
+ }
40
49
  },
41
- "import": {
42
- "types": "./dist/index.d.ts",
43
- "default": "./dist/index.js"
50
+ "./docusaurus": {
51
+ "require": {
52
+ "types": "./dist/docusaurus/index.d.ts",
53
+ "default": "./dist/docusaurus/index.js"
54
+ },
55
+ "import": {
56
+ "types": "./dist/docusaurus/index.d.ts",
57
+ "default": "./dist/docusaurus/index.js"
58
+ },
59
+ "default": {
60
+ "types": "./dist/docusaurus/index.d.ts",
61
+ "default": "./dist/docusaurus/index.js"
62
+ }
63
+ },
64
+ "./docfx": {
65
+ "require": {
66
+ "types": "./dist/docfx/index.d.ts",
67
+ "default": "./dist/docfx/index.js"
68
+ },
69
+ "import": {
70
+ "types": "./dist/docfx/index.d.ts",
71
+ "default": "./dist/docfx/index.js"
72
+ },
73
+ "default": {
74
+ "types": "./dist/docfx/index.d.ts",
75
+ "default": "./dist/docfx/index.js"
76
+ }
77
+ },
78
+ "./fumadocs": {
79
+ "require": {
80
+ "types": "./dist/fumadocs/index.d.ts",
81
+ "default": "./dist/fumadocs/index.js"
82
+ },
83
+ "import": {
84
+ "types": "./dist/fumadocs/index.d.ts",
85
+ "default": "./dist/fumadocs/index.js"
86
+ },
87
+ "default": {
88
+ "types": "./dist/fumadocs/index.d.ts",
89
+ "default": "./dist/fumadocs/index.js"
90
+ }
91
+ },
92
+ "./honkit": {
93
+ "require": {
94
+ "types": "./dist/honkit/index.d.ts",
95
+ "default": "./dist/honkit/index.js"
96
+ },
97
+ "import": {
98
+ "types": "./dist/honkit/index.d.ts",
99
+ "default": "./dist/honkit/index.js"
100
+ },
101
+ "default": {
102
+ "types": "./dist/honkit/index.d.ts",
103
+ "default": "./dist/honkit/index.js"
104
+ }
105
+ },
106
+ "./hugo": {
107
+ "require": {
108
+ "types": "./dist/hugo/index.d.ts",
109
+ "default": "./dist/hugo/index.js"
110
+ },
111
+ "import": {
112
+ "types": "./dist/hugo/index.d.ts",
113
+ "default": "./dist/hugo/index.js"
114
+ },
115
+ "default": {
116
+ "types": "./dist/hugo/index.d.ts",
117
+ "default": "./dist/hugo/index.js"
118
+ }
119
+ },
120
+ "./mdbook": {
121
+ "require": {
122
+ "types": "./dist/mdbook/index.d.ts",
123
+ "default": "./dist/mdbook/index.js"
124
+ },
125
+ "import": {
126
+ "types": "./dist/mdbook/index.d.ts",
127
+ "default": "./dist/mdbook/index.js"
128
+ },
129
+ "default": {
130
+ "types": "./dist/mdbook/index.d.ts",
131
+ "default": "./dist/mdbook/index.js"
132
+ }
133
+ },
134
+ "./mkdocs": {
135
+ "require": {
136
+ "types": "./dist/mkdocs/index.d.ts",
137
+ "default": "./dist/mkdocs/index.js"
138
+ },
139
+ "import": {
140
+ "types": "./dist/mkdocs/index.d.ts",
141
+ "default": "./dist/mkdocs/index.js"
142
+ },
143
+ "default": {
144
+ "types": "./dist/mkdocs/index.d.ts",
145
+ "default": "./dist/mkdocs/index.js"
146
+ }
147
+ },
148
+ "./starlight": {
149
+ "require": {
150
+ "types": "./dist/starlight/index.d.ts",
151
+ "default": "./dist/starlight/index.js"
152
+ },
153
+ "import": {
154
+ "types": "./dist/starlight/index.d.ts",
155
+ "default": "./dist/starlight/index.js"
156
+ },
157
+ "default": {
158
+ "types": "./dist/starlight/index.d.ts",
159
+ "default": "./dist/starlight/index.js"
160
+ }
161
+ },
162
+ "./vocs": {
163
+ "require": {
164
+ "types": "./dist/vocs/index.d.ts",
165
+ "default": "./dist/vocs/index.js"
166
+ },
167
+ "import": {
168
+ "types": "./dist/vocs/index.d.ts",
169
+ "default": "./dist/vocs/index.js"
170
+ },
171
+ "default": {
172
+ "types": "./dist/vocs/index.d.ts",
173
+ "default": "./dist/vocs/index.js"
174
+ }
175
+ },
176
+ "./defaults": {
177
+ "require": {
178
+ "types": "./dist/defaults.d.ts",
179
+ "default": "./dist/defaults.js"
180
+ },
181
+ "import": {
182
+ "types": "./dist/defaults.d.ts",
183
+ "default": "./dist/defaults.js"
184
+ },
185
+ "default": {
186
+ "types": "./dist/defaults.d.ts",
187
+ "default": "./dist/defaults.js"
188
+ }
189
+ },
190
+ "./package.json": "./package.json"
44
191
  },
45
- "default": {
46
- "types": "./dist/index.d.ts",
47
- "default": "./dist/index.js"
48
- }
49
- },
50
- "./docusaurus": {
51
- "require": {
52
- "types": "./dist/docusaurus/index.d.ts",
53
- "default": "./dist/docusaurus/index.js"
54
- },
55
- "import": {
56
- "types": "./dist/docusaurus/index.d.ts",
57
- "default": "./dist/docusaurus/index.js"
58
- },
59
- "default": {
60
- "types": "./dist/docusaurus/index.d.ts",
61
- "default": "./dist/docusaurus/index.js"
62
- }
63
- },
64
- "./docfx": {
65
- "require": {
66
- "types": "./dist/docfx/index.d.ts",
67
- "default": "./dist/docfx/index.js"
68
- },
69
- "import": {
70
- "types": "./dist/docfx/index.d.ts",
71
- "default": "./dist/docfx/index.js"
72
- },
73
- "default": {
74
- "types": "./dist/docfx/index.d.ts",
75
- "default": "./dist/docfx/index.js"
76
- }
77
- },
78
- "./fumadocs": {
79
- "require": {
80
- "types": "./dist/fumadocs/index.d.ts",
81
- "default": "./dist/fumadocs/index.js"
82
- },
83
- "import": {
84
- "types": "./dist/fumadocs/index.d.ts",
85
- "default": "./dist/fumadocs/index.js"
86
- },
87
- "default": {
88
- "types": "./dist/fumadocs/index.d.ts",
89
- "default": "./dist/fumadocs/index.js"
90
- }
91
- },
92
- "./honkit": {
93
- "require": {
94
- "types": "./dist/honkit/index.d.ts",
95
- "default": "./dist/honkit/index.js"
96
- },
97
- "import": {
98
- "types": "./dist/honkit/index.d.ts",
99
- "default": "./dist/honkit/index.js"
100
- },
101
- "default": {
102
- "types": "./dist/honkit/index.d.ts",
103
- "default": "./dist/honkit/index.js"
104
- }
105
- },
106
- "./hugo": {
107
- "require": {
108
- "types": "./dist/hugo/index.d.ts",
109
- "default": "./dist/hugo/index.js"
110
- },
111
- "import": {
112
- "types": "./dist/hugo/index.d.ts",
113
- "default": "./dist/hugo/index.js"
114
- },
115
- "default": {
116
- "types": "./dist/hugo/index.d.ts",
117
- "default": "./dist/hugo/index.js"
118
- }
119
- },
120
- "./mdbook": {
121
- "require": {
122
- "types": "./dist/mdbook/index.d.ts",
123
- "default": "./dist/mdbook/index.js"
124
- },
125
- "import": {
126
- "types": "./dist/mdbook/index.d.ts",
127
- "default": "./dist/mdbook/index.js"
128
- },
129
- "default": {
130
- "types": "./dist/mdbook/index.d.ts",
131
- "default": "./dist/mdbook/index.js"
132
- }
133
- },
134
- "./mkdocs": {
135
- "require": {
136
- "types": "./dist/mkdocs/index.d.ts",
137
- "default": "./dist/mkdocs/index.js"
138
- },
139
- "import": {
140
- "types": "./dist/mkdocs/index.d.ts",
141
- "default": "./dist/mkdocs/index.js"
142
- },
143
- "default": {
144
- "types": "./dist/mkdocs/index.d.ts",
145
- "default": "./dist/mkdocs/index.js"
146
- }
147
- },
148
- "./starlight": {
149
- "require": {
150
- "types": "./dist/starlight/index.d.ts",
151
- "default": "./dist/starlight/index.js"
152
- },
153
- "import": {
154
- "types": "./dist/starlight/index.d.ts",
155
- "default": "./dist/starlight/index.js"
156
- },
157
- "default": {
158
- "types": "./dist/starlight/index.d.ts",
159
- "default": "./dist/starlight/index.js"
160
- }
161
- },
162
- "./vocs": {
163
- "require": {
164
- "types": "./dist/vocs/index.d.ts",
165
- "default": "./dist/vocs/index.js"
166
- },
167
- "import": {
168
- "types": "./dist/vocs/index.d.ts",
169
- "default": "./dist/vocs/index.js"
170
- },
171
- "default": {
172
- "types": "./dist/vocs/index.d.ts",
173
- "default": "./dist/vocs/index.js"
174
- }
175
- },
176
- "./defaults": {
177
- "require": {
178
- "types": "./dist/defaults.d.ts",
179
- "default": "./dist/defaults.js"
180
- },
181
- "import": {
182
- "types": "./dist/defaults.d.ts",
183
- "default": "./dist/defaults.js"
184
- },
185
- "default": {
186
- "types": "./dist/defaults.d.ts",
187
- "default": "./dist/defaults.js"
188
- }
189
- },
190
- "./package.json": "./package.json"
191
- },
192
- "scripts": {
193
- "stryker": "stryker run",
194
- "clean": "tsgo --build --clean && rm -rf ./dist",
195
- "docs": "typedoc --options typedoc.config.mjs",
196
- "build": "tsgo --build",
197
- "lint": "eslint --config ../../packages/tooling-config/eslint/config.ts \"{src,tests}/**/*.{ts,js,json,gql}\"",
198
- "lint:fix": "eslint --config ../../packages/tooling-config/eslint/config.ts \"{src,tests}/**/*.{ts,js,json,gql}\" --fix",
199
- "prettier": "prettier \"{src,tests}/**/*.{ts,js,json,md,gql}\" --check",
200
- "prettier:fix": "prettier \"{src,tests}/**/*.{ts,js,json,md,gql}\" --write",
201
- "ts:check": "tsgo --noEmit",
202
- "test": "jest",
203
- "test:unit": "jest --passWithNoTests --testPathPatterns=tests/unit",
204
- "test:integration": "jest --passWithNoTests --testPathPatterns=tests/integration",
205
- "test:ci": "jest --passWithNoTests --ci --silent --randomize --runInBand",
206
- "test:watch": "jest --watch"
207
- },
208
- "dependencies": {
209
- "@graphql-markdown/helpers": "^1.1.0",
210
- "@graphql-markdown/types": "^1.13.0",
211
- "@graphql-markdown/utils": "^1.12.0"
212
- },
213
- "devDependencies": {
214
- "@graphql-markdown/tooling-config": "^1.0.0"
215
- },
216
- "directories": {
217
- "test": "tests"
218
- },
219
- "engines": {
220
- "node": ">=20"
221
- },
222
- "publishConfig": {
223
- "access": "public"
224
- },
225
- "typescript": {
226
- "definition": "dist/index.d.ts"
227
- },
228
- "files": [
229
- "dist"
230
- ]
192
+ "scripts": {
193
+ "stryker": "stryker run",
194
+ "clean": "tsgo --build --clean && rm -rf ./dist",
195
+ "docs": "typedoc --options typedoc.config.mjs",
196
+ "build": "tsgo --build",
197
+ "lint": "eslint --config ../../packages/tooling-config/eslint/config.ts \"{src,tests}/**/*.{ts,js,json,gql}\"",
198
+ "lint:fix": "eslint --config ../../packages/tooling-config/eslint/config.ts \"{src,tests}/**/*.{ts,js,json,gql}\" --fix",
199
+ "prettier": "prettier \"{src,tests}/**/*.{ts,js,json,md,gql}\" --check",
200
+ "prettier:fix": "prettier \"{src,tests}/**/*.{ts,js,json,md,gql}\" --write",
201
+ "ts:check": "tsgo --noEmit",
202
+ "test": "vitest run --passWithNoTests",
203
+ "test:unit": "vitest run --passWithNoTests tests/unit",
204
+ "test:integration": "vitest run --passWithNoTests tests/integration",
205
+ "test:ci": "vitest run --passWithNoTests --silent --sequence.shuffle",
206
+ "test:watch": "vitest --watch"
207
+ },
208
+ "dependencies": {
209
+ "@graphql-markdown/helpers": "",
210
+ "@graphql-markdown/types": "",
211
+ "@graphql-markdown/utils": ""
212
+ },
213
+ "devDependencies": {
214
+ "@graphql-markdown/tooling-config": ""
215
+ },
216
+ "directories": {
217
+ "test": "tests"
218
+ },
219
+ "engines": {
220
+ "node": ">=22.12.0"
221
+ },
222
+ "publishConfig": {
223
+ "access": "public"
224
+ },
225
+ "typescript": {
226
+ "definition": "dist/index.d.ts"
227
+ },
228
+ "files": [
229
+ "dist"
230
+ ]
231
231
  }
package/dist/docfx.d.ts DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * DocFX formatter for GraphQL documentation output.
3
- *
4
- * Produces Markdown compatible with Microsoft DocFX.
5
- * Uses DocFX alert syntax for admonitions and injects the required
6
- * `uid` front matter field for cross-reference resolution.
7
- *
8
- * @packageDocumentation
9
- */
10
- import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
11
- export declare const formatMDXBadge: ({ text }: Badge) => MDXString;
12
- export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, _meta: Maybe<MetaInfo>) => MDXString;
13
- export declare const formatMDXBullet: (text?: string) => MDXString;
14
- export declare const formatMDXDetails: ({ dataOpen, dataClose, }: CollapsibleOption) => MDXString;
15
- export declare const formatMDXFrontmatter: (props: Maybe<FrontMatterOptions>, formatted: Maybe<string[]>) => MDXString;
16
- export declare const formatMDXLink: (link: TypeLink) => TypeLink;
17
- export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
18
- export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
19
- export declare const createMDXFormatter: (_meta?: Maybe<MetaInfo>) => Formatter;
20
- //# sourceMappingURL=docfx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docfx.d.ts","sourceRoot":"","sources":["../src/docfx.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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;AAyBjC,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SACwB,CAAC;AAE1E,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF,eAAO,MAAM,eAAe,qBAAgB,SACR,CAAC;AAErC,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAC0L,CAAC;AAElN,eAAO,MAAM,oBAAoB,UACxB,KAAK,CAAC,kBAAkB,CAAC,aACrB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAaF,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAAgB,CAAC;AAEhE,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAGF,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SACb,CAAC;AAE3C,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAS3D,CAAC"}
package/dist/docfx.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- /**
3
- * DocFX formatter for GraphQL documentation output.
4
- *
5
- * Produces Markdown compatible with Microsoft DocFX.
6
- * Uses DocFX alert syntax for admonitions and injects the required
7
- * `uid` front matter field for cross-reference resolution.
8
- *
9
- * @packageDocumentation
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXLink = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
13
- const utils_1 = require("@graphql-markdown/utils");
14
- // Maps graphql-markdown admonition types to DocFX alert types
15
- const ALERT_TYPE_MAP = {
16
- note: "NOTE",
17
- tip: "TIP",
18
- info: "IMPORTANT",
19
- warning: "WARNING",
20
- danger: "CAUTION",
21
- deprecated: "WARNING",
22
- caution: "CAUTION",
23
- success: "NOTE",
24
- };
25
- const quoteLines = (text) => text
26
- .split(utils_1.MARKDOWN_EOL)
27
- .map((line) => `> ${line}`)
28
- .join(utils_1.MARKDOWN_EOL);
29
- const formatMDXBadge = ({ text }) => `<mark class="gqlmd-docfx-badge">${text}</mark>`;
30
- exports.formatMDXBadge = formatMDXBadge;
31
- const formatMDXAdmonition = ({ text, title, type }, _meta) => {
32
- const alertType = ALERT_TYPE_MAP[type.toLowerCase()] ?? "NOTE";
33
- const titleLine = title ? `${utils_1.MARKDOWN_EOL}> **${title}**` : "";
34
- return `${utils_1.MARKDOWN_EOP}> [!${alertType}]${titleLine}${utils_1.MARKDOWN_EOL}${quoteLines(text)}${utils_1.MARKDOWN_EOL}`;
35
- };
36
- exports.formatMDXAdmonition = formatMDXAdmonition;
37
- const formatMDXBullet = (text = "") => `&bull;&nbsp;${text}`;
38
- exports.formatMDXBullet = formatMDXBullet;
39
- const formatMDXDetails = ({ dataOpen, dataClose, }) => `${utils_1.MARKDOWN_EOP}<details>${utils_1.MARKDOWN_EOL}<summary>${dataOpen}</summary>${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_EOL}\r${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_EOL}<em>${dataClose}</em>${utils_1.MARKDOWN_EOL}</details>${utils_1.MARKDOWN_EOP}`;
40
- exports.formatMDXDetails = formatMDXDetails;
41
- const formatMDXFrontmatter = (props, formatted) => {
42
- if (!formatted)
43
- return "";
44
- // DocFX requires a uid field for cross-reference resolution between pages
45
- const id = props && typeof props === "object" && "id" in props
46
- ? props.id
47
- : undefined;
48
- const uidLine = id ? [` uid: ${id}`] : [];
49
- return [utils_1.FRONT_MATTER_DELIMITER, ...uidLine, ...formatted, utils_1.FRONT_MATTER_DELIMITER].join(utils_1.MARKDOWN_EOL);
50
- };
51
- exports.formatMDXFrontmatter = formatMDXFrontmatter;
52
- const formatMDXLink = (link) => link;
53
- exports.formatMDXLink = formatMDXLink;
54
- const formatMDXNameEntity = (name, parentType) => {
55
- const parentName = parentType ? `${parentType}.` : "";
56
- return `\`${parentName}${name}\``;
57
- };
58
- exports.formatMDXNameEntity = formatMDXNameEntity;
59
- const formatMDXSpecifiedByLink = (url) => `[Specification ⎘](${url})`;
60
- exports.formatMDXSpecifiedByLink = formatMDXSpecifiedByLink;
61
- const createMDXFormatter = (_meta) => ({
62
- formatMDXBadge: exports.formatMDXBadge,
63
- formatMDXAdmonition: exports.formatMDXAdmonition,
64
- formatMDXBullet: exports.formatMDXBullet,
65
- formatMDXDetails: exports.formatMDXDetails,
66
- formatMDXFrontmatter: exports.formatMDXFrontmatter,
67
- formatMDXLink: exports.formatMDXLink,
68
- formatMDXNameEntity: exports.formatMDXNameEntity,
69
- formatMDXSpecifiedByLink: exports.formatMDXSpecifiedByLink,
70
- });
71
- exports.createMDXFormatter = createMDXFormatter;
@@ -1,20 +0,0 @@
1
- /**
2
- * Docusaurus MDX formatter for GraphQL documentation output.
3
- *
4
- * Produces MDX markup compatible with Docusaurus v2 and v3,
5
- * using Badge, Bullet, SpecifiedBy components and native admonition syntax.
6
- *
7
- * @packageDocumentation
8
- */
9
- import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
10
- export declare const mdxDeclaration: MDXString;
11
- export declare const formatMDXBadge: ({ text, classname }: Badge) => MDXString;
12
- export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, meta: Maybe<MetaInfo>) => MDXString;
13
- export declare const formatMDXBullet: (text?: string) => MDXString;
14
- export declare const formatMDXDetails: ({ dataOpen, dataClose, }: CollapsibleOption) => MDXString;
15
- export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
16
- export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
17
- export declare const formatMDXLink: ({ text, url }: TypeLink) => TypeLink;
18
- export declare const formatMDXFrontmatter: (_props: Maybe<FrontMatterOptions>, formatted: Maybe<string[]>) => MDXString;
19
- export declare const createMDXFormatter: (meta?: Maybe<MetaInfo>) => Formatter;
20
- //# sourceMappingURL=docusaurus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docusaurus.d.ts","sourceRoot":"","sources":["../src/docusaurus.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,eAAO,MAAM,cAAc,EAAE,SAQf,CAAC;AAEf,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAI3D,CAAC;AAEF,eAAO,MAAM,mBAAmB,0BACP,cAAc,QAC/B,KAAK,CAAC,QAAQ,CAAC,KACpB,SAOF,CAAC;AAEF,eAAO,MAAM,eAAe,UAAU,MAAM,KAAQ,SAClB,CAAC;AAEnC,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAItB,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SACX,CAAC;AAE7C,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAGF,CAAC;AAEF,eAAO,MAAM,aAAa,kBAAmB,QAAQ,KAAG,QAGtD,CAAC;AAEH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAKoB,CAAC;AAExB,eAAO,MAAM,kBAAkB,UAAW,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY1D,CAAC"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- /**
3
- * Docusaurus MDX formatter for GraphQL documentation output.
4
- *
5
- * Produces MDX markup compatible with Docusaurus v2 and v3,
6
- * using Badge, Bullet, SpecifiedBy components and native admonition syntax.
7
- *
8
- * @packageDocumentation
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.createMDXFormatter = exports.formatMDXFrontmatter = exports.formatMDXLink = exports.formatMDXNameEntity = exports.formatMDXSpecifiedByLink = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxDeclaration = void 0;
12
- const utils_1 = require("@graphql-markdown/utils");
13
- const LINK_MDX_EXTENSION = ".mdx";
14
- const DEFAULT_CSS_CLASSNAME = "badge--secondary";
15
- exports.mdxDeclaration = `
16
- export const Bullet = () => <><span style={{ fontWeight: 'normal', fontSize: '.5em', color: 'var(--ifm-color-secondary-darkest)' }}>&nbsp;●&nbsp;</span></>
17
-
18
- export const SpecifiedBy = (props) => <>Specification<a className="link" style={{ fontSize:'1.5em', paddingLeft:'4px' }} target="_blank" href={props.url} title={'Specified by ' + props.url}>⎘</a></>
19
-
20
- export const Badge = (props) => <><span className={props.class}>{props.text}</span></>
21
-
22
-
23
- `;
24
- const formatMDXBadge = ({ text, classname }) => {
25
- const style = typeof classname === "string" ? `badge--${classname.toLowerCase()}` : "";
26
- return `<Badge class="badge ${DEFAULT_CSS_CLASSNAME} ${style}" text="${text}"/>`;
27
- };
28
- exports.formatMDXBadge = formatMDXBadge;
29
- const formatMDXAdmonition = ({ text, title, type }, meta) => {
30
- const isDocusaurus = meta?.generatorFrameworkName === "docusaurus";
31
- if (isDocusaurus && meta.generatorFrameworkVersion?.startsWith("2")) {
32
- const oldType = type === "warning" ? "caution" : type;
33
- return `${utils_1.MARKDOWN_EOP}:::${oldType} ${title}${text}:::`;
34
- }
35
- return `${utils_1.MARKDOWN_EOP}:::${type}[${title}]${text}:::`;
36
- };
37
- exports.formatMDXAdmonition = formatMDXAdmonition;
38
- const formatMDXBullet = (text = "") => `<Bullet />${text}`;
39
- exports.formatMDXBullet = formatMDXBullet;
40
- const formatMDXDetails = ({ dataOpen, dataClose, }) => {
41
- const openLabel = (0, utils_1.escapeMDX)(`Hide ${dataOpen}`);
42
- const closeLabel = (0, utils_1.escapeMDX)(`Show ${dataClose}`);
43
- return `${utils_1.MARKDOWN_EOP}<details class="graphql-markdown-details">${utils_1.MARKDOWN_EOL}<summary>${utils_1.MARKDOWN_EOL}<span class="graphql-markdown-details-label-closed">${closeLabel}</span>${utils_1.MARKDOWN_EOL}<span class="graphql-markdown-details-label-open" hidden>${openLabel}</span>${utils_1.MARKDOWN_EOL}</summary>${utils_1.MARKDOWN_EOP}\r${utils_1.MARKDOWN_EOP}</details>${utils_1.MARKDOWN_EOP}`;
44
- };
45
- exports.formatMDXDetails = formatMDXDetails;
46
- const formatMDXSpecifiedByLink = (url) => `<SpecifiedBy url="${url}"/>`;
47
- exports.formatMDXSpecifiedByLink = formatMDXSpecifiedByLink;
48
- const formatMDXNameEntity = (name, parentType) => {
49
- const parentName = parentType ? `${parentType}.` : "";
50
- return `<code style={{ fontWeight: 'normal' }}>${(0, utils_1.escapeMDX)(parentName)}<b>${(0, utils_1.escapeMDX)(name)}</b></code>`;
51
- };
52
- exports.formatMDXNameEntity = formatMDXNameEntity;
53
- const formatMDXLink = ({ text, url }) => ({
54
- text,
55
- url: `${url}${LINK_MDX_EXTENSION}`,
56
- });
57
- exports.formatMDXLink = formatMDXLink;
58
- const formatMDXFrontmatter = (_props, formatted) => formatted
59
- ? [utils_1.FRONT_MATTER_DELIMITER, ...formatted, utils_1.FRONT_MATTER_DELIMITER].join(utils_1.MARKDOWN_EOL)
60
- : "";
61
- exports.formatMDXFrontmatter = formatMDXFrontmatter;
62
- const createMDXFormatter = (meta) => ({
63
- formatMDXBadge: exports.formatMDXBadge,
64
- formatMDXAdmonition: (admonition, _meta) => (0, exports.formatMDXAdmonition)(admonition, meta ?? _meta),
65
- formatMDXBullet: exports.formatMDXBullet,
66
- formatMDXDetails: exports.formatMDXDetails,
67
- formatMDXFrontmatter: exports.formatMDXFrontmatter,
68
- formatMDXLink: exports.formatMDXLink,
69
- formatMDXNameEntity: exports.formatMDXNameEntity,
70
- formatMDXSpecifiedByLink: exports.formatMDXSpecifiedByLink,
71
- });
72
- exports.createMDXFormatter = createMDXFormatter;
package/dist/hugo.d.ts DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * Hugo formatter for GraphQL documentation output.
3
- *
4
- * Produces Markdown compatible with Hugo static site generator.
5
- * Uses GitHub-style alerts (Hugo 0.132+) for admonitions and
6
- * strips file extensions from internal links to match Hugo's URL routing.
7
- *
8
- * @packageDocumentation
9
- */
10
- import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
11
- export declare const formatMDXBadge: ({ text }: Badge) => MDXString;
12
- export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, _meta: Maybe<MetaInfo>) => MDXString;
13
- export declare const formatMDXBullet: (text?: string) => MDXString;
14
- export declare const formatMDXDetails: ({ dataOpen, dataClose, }: CollapsibleOption) => MDXString;
15
- export declare const formatMDXFrontmatter: (_props: Maybe<FrontMatterOptions>, formatted: Maybe<string[]>) => MDXString;
16
- export declare const formatMDXLink: ({ text, url }: TypeLink) => TypeLink;
17
- export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
18
- export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
19
- export declare const createMDXFormatter: (_meta?: Maybe<MetaInfo>) => Formatter;
20
- //# sourceMappingURL=hugo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hugo.d.ts","sourceRoot":"","sources":["../src/hugo.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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;AAyBjC,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SACuB,CAAC;AAEzE,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF,eAAO,MAAM,eAAe,qBAAgB,SACR,CAAC;AAErC,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SACiM,CAAC;AAEzN,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAKoB,CAAC;AAGxB,eAAO,MAAM,aAAa,kBAAmB,QAAQ,KAAG,QAGtD,CAAC;AAEH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAGF,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SACb,CAAC;AAE3C,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAS3D,CAAC"}