@graphql-markdown/printer-legacy 1.13.1 → 1.14.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/const/options.d.ts.map +1 -1
- package/dist/const/options.js +1 -0
- package/dist/const/strings.d.ts +15 -0
- package/dist/const/strings.d.ts.map +1 -1
- package/dist/const/strings.js +9 -0
- package/dist/graphql/input.d.ts +13 -0
- package/dist/graphql/input.d.ts.map +1 -1
- package/dist/graphql/input.js +8 -0
- package/dist/link.d.ts +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +47 -7
- package/dist/printer.d.ts +2 -1
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +3 -1
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +8 -2
- package/package.json +4 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAIjC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB,IAAI,KAAK;IACT,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,6BAA6B,CAU5E,CAAC;AAEJ,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,IAAI,CACF,gBAAgB,EACd,aAAa,GACb,0BAA0B,GAC1B,QAAQ,GACR,OAAO,GACP,MAAM,GACN,mBAAmB,GACnB,YAAY,GACZ,QAAQ,GACR,mBAAmB,GACnB,sBAAsB,GACtB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,2BAA2B,GAC3B,0BAA0B,GAC1B,0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GAAG;IACF,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACtC,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CAiBvC,CAAC"}
|
package/dist/const/options.js
CHANGED
package/dist/const/strings.d.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String constants and helpers shared by the legacy printer when composing
|
|
3
|
+
* Markdown fragments for GraphQL schemas.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
1
7
|
import type { RootTypeLocale } from "@graphql-markdown/types";
|
|
2
8
|
export { FRONT_MATTER_DELIMITER, MARKDOWN_CODE_INDENTATION, MARKDOWN_CODE_SNIPPET, MARKDOWN_EOL, MARKDOWN_EOP, } from "@graphql-markdown/utils";
|
|
9
|
+
/**
|
|
10
|
+
* Human-readable labels for each GraphQL root type used when rendering copy or badges.
|
|
11
|
+
*/
|
|
3
12
|
export declare const ROOT_TYPE_LOCALE: RootTypeLocale;
|
|
13
|
+
/** Label used when a schema element is flagged as deprecated. */
|
|
4
14
|
export declare const DEPRECATED: "deprecated";
|
|
15
|
+
/** Copy fragment describing a non-null GraphQL modifier. */
|
|
5
16
|
export declare const NON_NULL: "non-null";
|
|
17
|
+
/** Short identifier for the GraphQL language tag used in fenced blocks. */
|
|
6
18
|
export declare const GRAPHQL: "graphql";
|
|
19
|
+
/** Default placeholder when no schema description is provided. */
|
|
7
20
|
export declare const NO_DESCRIPTION_TEXT: "No description";
|
|
21
|
+
/** Helper for inserting the code-block end delimiter in generated Markdown. */
|
|
8
22
|
export declare const MARKDOWN_EOC: "\n```\n";
|
|
23
|
+
/** Helper for inserting the code-block start delimiter targeting GraphQL syntax. */
|
|
9
24
|
export declare const MARKDOWN_SOC: "\n```graphql\n";
|
|
10
25
|
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,eAAO,MAAM,UAAU,cAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,UAAU,cAAwB,CAAC;AAEhD,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,YAAsB,CAAC;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,OAAO,WAAqB,CAAC;AAE1C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,kBAA4B,CAAC;AAE7D,+EAA+E;AAC/E,eAAO,MAAM,YAAY,WAC0C,CAAC;AAEpE,oFAAoF;AACpF,eAAO,MAAM,YAAY,kBACoD,CAAC"}
|
package/dist/const/strings.js
CHANGED
|
@@ -8,6 +8,9 @@ Object.defineProperty(exports, "MARKDOWN_CODE_INDENTATION", { enumerable: true,
|
|
|
8
8
|
Object.defineProperty(exports, "MARKDOWN_CODE_SNIPPET", { enumerable: true, get: function () { return utils_2.MARKDOWN_CODE_SNIPPET; } });
|
|
9
9
|
Object.defineProperty(exports, "MARKDOWN_EOL", { enumerable: true, get: function () { return utils_2.MARKDOWN_EOL; } });
|
|
10
10
|
Object.defineProperty(exports, "MARKDOWN_EOP", { enumerable: true, get: function () { return utils_2.MARKDOWN_EOP; } });
|
|
11
|
+
/**
|
|
12
|
+
* Human-readable labels for each GraphQL root type used when rendering copy or badges.
|
|
13
|
+
*/
|
|
11
14
|
exports.ROOT_TYPE_LOCALE = {
|
|
12
15
|
DIRECTIVE: { singular: "directive", plural: "directives" },
|
|
13
16
|
ENUM: { singular: "enum", plural: "enums" },
|
|
@@ -21,9 +24,15 @@ exports.ROOT_TYPE_LOCALE = {
|
|
|
21
24
|
TYPE: { singular: "object", plural: "objects" },
|
|
22
25
|
UNION: { singular: "union", plural: "unions" },
|
|
23
26
|
};
|
|
27
|
+
/** Label used when a schema element is flagged as deprecated. */
|
|
24
28
|
exports.DEPRECATED = "deprecated";
|
|
29
|
+
/** Copy fragment describing a non-null GraphQL modifier. */
|
|
25
30
|
exports.NON_NULL = "non-null";
|
|
31
|
+
/** Short identifier for the GraphQL language tag used in fenced blocks. */
|
|
26
32
|
exports.GRAPHQL = "graphql";
|
|
33
|
+
/** Default placeholder when no schema description is provided. */
|
|
27
34
|
exports.NO_DESCRIPTION_TEXT = "No description";
|
|
35
|
+
/** Helper for inserting the code-block end delimiter in generated Markdown. */
|
|
28
36
|
exports.MARKDOWN_EOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${utils_1.MARKDOWN_EOL}`;
|
|
37
|
+
/** Helper for inserting the code-block start delimiter targeting GraphQL syntax. */
|
|
29
38
|
exports.MARKDOWN_SOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${exports.GRAPHQL}${utils_1.MARKDOWN_EOL}`;
|
package/dist/graphql/input.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy printer helpers for rendering GraphQL input types.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
1
6
|
import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
2
7
|
export { printObjectMetadata as printInputMetadata } from "./object";
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Markdown code snippet for a GraphQL `input` type by delegating
|
|
10
|
+
* to the generic object printer while forcing the `input` kind.
|
|
11
|
+
*
|
|
12
|
+
* @param type - The GraphQL input definition or SDL node to print.
|
|
13
|
+
* @param options - Printer options controlling headings, examples, and badges.
|
|
14
|
+
* @returns Markdown code block representing the input signature.
|
|
15
|
+
*/
|
|
3
16
|
export declare const printCodeInput: (type: unknown, options: PrintTypeOptions) => string;
|
|
4
17
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/graphql/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAErE,eAAO,MAAM,cAAc,sDAK1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/graphql/input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,sDAK1B,CAAC"}
|
package/dist/graphql/input.js
CHANGED
|
@@ -4,6 +4,14 @@ exports.printCodeInput = exports.printInputMetadata = void 0;
|
|
|
4
4
|
const object_1 = require("./object");
|
|
5
5
|
const object_2 = require("./object");
|
|
6
6
|
Object.defineProperty(exports, "printInputMetadata", { enumerable: true, get: function () { return object_2.printObjectMetadata; } });
|
|
7
|
+
/**
|
|
8
|
+
* Renders the Markdown code snippet for a GraphQL `input` type by delegating
|
|
9
|
+
* to the generic object printer while forcing the `input` kind.
|
|
10
|
+
*
|
|
11
|
+
* @param type - The GraphQL input definition or SDL node to print.
|
|
12
|
+
* @param options - Printer options controlling headings, examples, and badges.
|
|
13
|
+
* @returns Markdown code block representing the input signature.
|
|
14
|
+
*/
|
|
7
15
|
const printCodeInput = (type, options) => {
|
|
8
16
|
return (0, object_1.printCodeType)(type, "input", options);
|
|
9
17
|
};
|
package/dist/link.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ export declare const printLinkAttributes: (type: unknown, text?: Maybe<string>)
|
|
|
92
92
|
* @param options - Configuration options for link generation
|
|
93
93
|
* @returns The formatted link as a string
|
|
94
94
|
*/
|
|
95
|
-
export declare const printLink: (
|
|
95
|
+
export declare const printLink: <T>(arg: T | Maybe<TypeLink>, options: PrintLinkOptions) => string;
|
|
96
96
|
/**
|
|
97
97
|
* Prints a parent link for a GraphQL type based on the provided options.
|
|
98
98
|
*
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAGpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAEhB,oBAAoB,EAGpB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAGpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAEhB,oBAAoB,EAGpB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAgCjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,oIA+BjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,sCAoB7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,uEAuBjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,wCAEnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,wCAO/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,2EASjC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,gEAKnC,CAAC;AASF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,oGAsFlB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,4FAc3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,iDAqB/B,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,gEAmC1B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,kEAc3B,CAAC"}
|
package/dist/link.js
CHANGED
|
@@ -157,9 +157,13 @@ const isHierarchy = (options, hierarchy) => {
|
|
|
157
157
|
* @returns The link object for the type
|
|
158
158
|
*/
|
|
159
159
|
const toLink = (type, name, operation, options) => {
|
|
160
|
+
const qualifiedName = typeof options.parentType === "string" && options.parentType.includes(".")
|
|
161
|
+
? `${options.parentType}.${name}`
|
|
162
|
+
: name;
|
|
160
163
|
const fallback = {
|
|
161
164
|
text: name,
|
|
162
165
|
url: "#",
|
|
166
|
+
id: (0, utils_1.slugify)(qualifiedName),
|
|
163
167
|
};
|
|
164
168
|
if (typeof type !== "object" || !(0, exports.hasPrintableDirective)(type, options)) {
|
|
165
169
|
return fallback;
|
|
@@ -193,7 +197,14 @@ const toLink = (type, name, operation, options) => {
|
|
|
193
197
|
? options.formatCategoryFolderName(folder)
|
|
194
198
|
: folder;
|
|
195
199
|
};
|
|
196
|
-
const
|
|
200
|
+
const operationNameParts = (0, graphql_1.isOperation)(type) && name.includes(".")
|
|
201
|
+
? name.split(".").filter(Boolean)
|
|
202
|
+
: [];
|
|
203
|
+
const operationNamespaceFolders = operationNameParts.slice(0, -1);
|
|
204
|
+
const operationLeafName = operationNameParts.at(-1) ?? text;
|
|
205
|
+
const url = utils_1.pathUrl.join(options.basePath, formatFolder(deprecatedFolder), formatFolder(groupFolder), formatFolder(apiGroupFolder), formatFolder(category), ...operationNamespaceFolders.map((folder) => {
|
|
206
|
+
return (0, utils_1.slugify)(folder);
|
|
207
|
+
}), `${(0, utils_1.slugify)(operationLeafName)}`);
|
|
197
208
|
const link = {
|
|
198
209
|
text,
|
|
199
210
|
url,
|
|
@@ -245,6 +256,21 @@ const printLinkAttributes = (type, text = "") => {
|
|
|
245
256
|
return text ?? "";
|
|
246
257
|
};
|
|
247
258
|
exports.printLinkAttributes = printLinkAttributes;
|
|
259
|
+
/**
|
|
260
|
+
* Determines whether the provided argument is a valid {@link TypeLink} object.
|
|
261
|
+
*
|
|
262
|
+
* Checks that the argument is a non-null object containing both `text` and `url` properties,
|
|
263
|
+
* and that both properties are strings.
|
|
264
|
+
*
|
|
265
|
+
* @param arg - The value to check.
|
|
266
|
+
* @returns `true` if the argument is a {@link TypeLink}, otherwise `false`.
|
|
267
|
+
*/
|
|
268
|
+
const isLinkType = (arg) => {
|
|
269
|
+
return (typeof arg === "object" &&
|
|
270
|
+
arg !== null &&
|
|
271
|
+
(0, utils_1.hasStringProperty)(arg, "text") &&
|
|
272
|
+
(0, utils_1.hasStringProperty)(arg, "url"));
|
|
273
|
+
};
|
|
248
274
|
/**
|
|
249
275
|
* Prints a link for a GraphQL type based on the provided options.
|
|
250
276
|
*
|
|
@@ -252,17 +278,31 @@ exports.printLinkAttributes = printLinkAttributes;
|
|
|
252
278
|
* @param options - Configuration options for link generation
|
|
253
279
|
* @returns The formatted link as a string
|
|
254
280
|
*/
|
|
255
|
-
const printLink = (
|
|
256
|
-
if (typeof
|
|
281
|
+
const printLink = (arg, options) => {
|
|
282
|
+
if (typeof arg !== "object" || arg === null) {
|
|
257
283
|
return "";
|
|
258
284
|
}
|
|
259
|
-
|
|
285
|
+
let link;
|
|
286
|
+
if (isLinkType(arg)) {
|
|
287
|
+
link = arg;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
link = (0, exports.toLink)(arg, (0, graphql_1.getTypeName)(arg, (0, utils_1.toString)(arg)), undefined, options);
|
|
291
|
+
}
|
|
292
|
+
const printFormattedLink = (text, link) => {
|
|
293
|
+
// create a permalink if url is not provided or is just a hash
|
|
294
|
+
if ((!link.url || link.url === "#") && typeof link.id === "string") {
|
|
295
|
+
const linkUrl = options.sectionHeaderId ? link.id : "";
|
|
296
|
+
return `[${text}](#${linkUrl})`;
|
|
297
|
+
}
|
|
298
|
+
return `[${text}](${link.url})`;
|
|
299
|
+
};
|
|
260
300
|
if (!(0, exports.hasOptionWithAttributes)(options)) {
|
|
261
301
|
const textWithAttribute = options.formatMDXNameEntity(link.text, options.parentType);
|
|
262
|
-
return
|
|
302
|
+
return printFormattedLink(textWithAttribute, link);
|
|
263
303
|
}
|
|
264
|
-
const text = (0, exports.printLinkAttributes)(
|
|
265
|
-
return
|
|
304
|
+
const text = (0, exports.printLinkAttributes)(arg, link.text);
|
|
305
|
+
return printFormattedLink(options.formatMDXNameEntity(text), link);
|
|
266
306
|
};
|
|
267
307
|
exports.printLink = printLink;
|
|
268
308
|
/**
|
package/dist/printer.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare class Printer implements IPrinter {
|
|
|
64
64
|
* @param mdxDeclaration - Optional MDX import declaration
|
|
65
65
|
* @param eventEmitter - Optional event emitter for print events interception
|
|
66
66
|
*/
|
|
67
|
-
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives }?: {
|
|
67
|
+
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, sectionHeaderId }?: {
|
|
68
68
|
customDirectives?: CustomDirectiveMap;
|
|
69
69
|
deprecated?: TypeDeprecatedOption;
|
|
70
70
|
groups?: SchemaEntitiesGroupMap;
|
|
@@ -73,6 +73,7 @@ export declare class Printer implements IPrinter {
|
|
|
73
73
|
onlyDocDirectives?: GraphQLDirective[];
|
|
74
74
|
printTypeOptions?: PrinterConfigPrintTypeOptions;
|
|
75
75
|
skipDocDirectives?: GraphQLDirective[];
|
|
76
|
+
sectionHeaderId?: boolean;
|
|
76
77
|
}, formatter?: Partial<Formatter>, mdxDeclaration?: Maybe<string>, eventEmitter?: Maybe<PrinterEventEmitter>): Promise<void>;
|
|
77
78
|
/**
|
|
78
79
|
* Prints the header section of a type documentation
|
package/dist/printer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAEhB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAEhB,aAAa,EACb,QAAQ,EACR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AAgB,CAAC,EAAE,6BAA6B,CAAC;QACjD,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;QACvC,eAAe,CAAC,EAAE,OAAO,CAAC;KACJ,EACxB,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC,CA0Cf;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,mEAYzB;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,uDAwCvB;IAEF;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,kFA8C5B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,uDAmB1B;IAEF;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,mEA2B/B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,mEAQ5B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,yEAiB3B;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,gHA4GvB;CACH"}
|
package/dist/printer.js
CHANGED
|
@@ -40,6 +40,7 @@ const example_1 = require("./example");
|
|
|
40
40
|
const DEFAULT_INIT_OPTIONS = {
|
|
41
41
|
customDirectives: undefined,
|
|
42
42
|
groups: undefined,
|
|
43
|
+
sectionHeaderId: true,
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* The Printer class implements the core functionality for generating Markdown documentation
|
|
@@ -97,7 +98,7 @@ class Printer {
|
|
|
97
98
|
* @param mdxDeclaration - Optional MDX import declaration
|
|
98
99
|
* @param eventEmitter - Optional event emitter for print events interception
|
|
99
100
|
*/
|
|
100
|
-
static async init(schema, baseURL = "schema", linkRoot = "/", { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, } = DEFAULT_INIT_OPTIONS, formatter, mdxDeclaration, eventEmitter) {
|
|
101
|
+
static async init(schema, baseURL = "schema", linkRoot = "/", { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, sectionHeaderId, } = DEFAULT_INIT_OPTIONS, formatter, mdxDeclaration, eventEmitter) {
|
|
101
102
|
// Always update eventEmitter regardless of initialization state
|
|
102
103
|
Printer.eventEmitter = eventEmitter ?? null;
|
|
103
104
|
if (Printer.options !== undefined) {
|
|
@@ -119,6 +120,7 @@ class Printer {
|
|
|
119
120
|
schema,
|
|
120
121
|
onlyDocDirectives: onlyDocDirectives ?? [],
|
|
121
122
|
skipDocDirectives: skipDocDirectives ?? [],
|
|
123
|
+
sectionHeaderId: sectionHeaderId ?? options_1.DEFAULT_OPTIONS.sectionHeaderId,
|
|
122
124
|
typeBadges: printTypeOptions?.typeBadges ?? options_1.PRINT_TYPE_DEFAULT_OPTIONS.typeBadges,
|
|
123
125
|
metatags: metatags ?? [],
|
|
124
126
|
hierarchy: printTypeOptions?.hierarchy ?? options_1.PRINT_TYPE_DEFAULT_OPTIONS.hierarchy,
|
package/dist/section.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAuBjC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,2DAmDjC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,mEAwBlC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,+FAqC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,4GAsDxC,CAAC"}
|
package/dist/section.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.printMetadataSection = exports.printSection = exports.printSectionItems = exports.printSectionItem = void 0;
|
|
9
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
9
10
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
10
11
|
const common_1 = require("./common");
|
|
11
12
|
const badge_1 = require("./badge");
|
|
@@ -27,14 +28,19 @@ const printSectionItem = (type, options) => {
|
|
|
27
28
|
if (!(0, link_1.hasPrintableDirective)(type, options)) {
|
|
28
29
|
return "";
|
|
29
30
|
}
|
|
30
|
-
const
|
|
31
|
+
const link = (0, link_1.toLink)(type, (0, graphql_1.getTypeName)(type, (0, utils_1.toString)(type)), undefined, options);
|
|
32
|
+
const typeNameLink = (0, link_1.printLink)(link, {
|
|
31
33
|
...options,
|
|
32
34
|
withAttributes: false,
|
|
33
35
|
});
|
|
34
36
|
const badges = (0, badge_1.printBadges)(type, options);
|
|
35
37
|
const tags = (0, directive_1.printCustomTags)(type, options);
|
|
36
38
|
const parentTypeLink = (0, link_1.printParentLink)(type, options);
|
|
37
|
-
const
|
|
39
|
+
const permalink = options.sectionHeaderId && link.id
|
|
40
|
+
? String.raw `\{#${link.id}\}`
|
|
41
|
+
: undefined; // use raw string to prevent MDX from interpreting the curly braces as JSX
|
|
42
|
+
const metadata = [badges, tags, permalink].filter(Boolean).join(" ");
|
|
43
|
+
const title = `${options_1.SectionLevels.LEVEL.repeat(level)} ${typeNameLink}${parentTypeLink} ${metadata} ${strings_1.MARKDOWN_EOL}`;
|
|
38
44
|
const description = (0, common_1.printDescription)(type, options, "")
|
|
39
45
|
.trim()
|
|
40
46
|
.replaceAll("\n", `${strings_1.MARKDOWN_EOL}`);
|
package/package.json
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/graphql-markdown/graphql-markdown/issues"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.14.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git+https://github.com/graphql-markdown/graphql-markdown.git",
|
|
13
|
-
"directory": "packages/
|
|
13
|
+
"directory": "packages/printer-legacy"
|
|
14
14
|
},
|
|
15
15
|
"author": {
|
|
16
16
|
"name": "Gregory Heitz"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@graphql-markdown/utils": "^1.9.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@graphql-markdown/types": "^1.
|
|
62
|
+
"@graphql-markdown/types": "^1.10.1"
|
|
63
63
|
},
|
|
64
64
|
"resolutions": {
|
|
65
65
|
"micromatch": "4.0.8"
|
|
@@ -71,9 +71,7 @@
|
|
|
71
71
|
"node": ">=20"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
|
-
"
|
|
75
|
-
"access": "public",
|
|
76
|
-
"scripts": {}
|
|
74
|
+
"access": "public"
|
|
77
75
|
},
|
|
78
76
|
"typescript": {
|
|
79
77
|
"definition": "dist/index.d.ts"
|