@graphql-markdown/printer-legacy 1.19.4 → 1.21.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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=graphql-markdown_printer-legacy&metric=coverage)](https://sonarcloud.io/summary/new_code?id=graphql-markdown_printer-legacy)
8
8
  [![Mutation Score](https://img.shields.io/endpoint?label=mutation%20score&style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fgraphql-markdown%2Fgraphql-markdown%2Fmain%3Fmodule%3Dprinter-legacy)](https://dashboard.stryker-mutator.io/reports/github.com/graphql-markdown/graphql-markdown/main?module=printer-legacy)
9
9
 
10
- Legacy Docusaurus-flavored MDX printer for GraphQL-Markdown. Converts GraphQL schema types into MDX pages, and is the printer used by default when no `formatter` is configured. New setups should prefer a formatter preset from [`@graphql-markdown/formatters`](https://www.npmjs.com/package/@graphql-markdown/formatters); this package is kept for backward compatibility with existing Docusaurus configurations and for `customDirective`-based decorators.
10
+ Legacy Docusaurus-flavored MDX printer for GraphQL-Markdown. Converts GraphQL schema types into MDX pages, and is the printer used by default when no `formatter` is configured. New setups should prefer a formatter preset from [`@graphql-markdown/formatters`](https://www.npmjs.com/package/@graphql-markdown/formatters); this package is kept for backward compatibility with existing Docusaurus configurations and for its built-in decorators support.
11
11
 
12
12
  ## Installation
13
13
 
@@ -26,17 +26,11 @@ await Printer.init(schema, baseURL, linkRoot, options);
26
26
  const page = await Printer.printType("query", queryType, options);
27
27
  ```
28
28
 
29
- ### Custom directive decorators
30
-
31
- ```ts
32
- import { buildCustomDirectiveDecorators } from "@graphql-markdown/printer-legacy";
33
- ```
34
-
35
29
  ## Documentation
36
30
 
37
- - [Configuration Options](https://graphql-markdown.dev/docs/settings)
38
- - [Custom Directives](https://graphql-markdown.dev/docs/advanced/custom-directive)
39
- - [Integration with Frameworks](https://graphql-markdown.dev/docs/advanced/integration-with-frameworks)
31
+ - [Configuration Options](https://graphql-markdown.dev/docs/reference/settings)
32
+ - [Decorators](https://graphql-markdown.dev/docs/customize/decorators)
33
+ - [Integration with Frameworks](https://graphql-markdown.dev/docs/guides/other-frameworks)
40
34
 
41
35
  ## License
42
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAsCjC;;;;;GAKG;AAEH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,KACxB,MAcF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,WAChB,MAAM,KACd,SAAS,GAAG,MAYd,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAsCjC;;;;;GAKG;AAEH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,KACxB,MAcF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,WAChB,MAAM,KACd,SAAS,GAAG,MASd,CAAC"}
package/dist/common.js CHANGED
@@ -66,9 +66,6 @@ exports.printDeprecation = printDeprecation;
66
66
  const printDescription = (type, options, noText) => {
67
67
  const description = formatDescription(type, noText);
68
68
  const deprecation = (0, exports.printDeprecation)(type, options);
69
- // `customDirective`'s `descriptor` handlers reach this line via the
70
- // decorators pipeline (`printSlotDecorators`), not a dedicated call — see
71
- // `buildCustomDirectiveDecorators` in `./decorator`.
72
69
  const decoratorContent = (0, decorator_ts_1.printSlotDecorators)("description", type, options);
73
70
  const decorators = decoratorContent.length > 0
74
71
  ? `${strings_ts_1.MARKDOWN_EOP}${decoratorContent.join(strings_ts_1.MARKDOWN_EOP)}`
@@ -17,11 +17,12 @@ export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<Omit<PrinterConfigPrin
17
17
  /**
18
18
  * Clean runtime options passed through the printer.
19
19
  */
20
- export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "decorators" | "entity" | "exampleSection" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
20
+ export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "decorators" | "entity" | "exampleSection" | "formatCategoryFolderName" | "formatMDXTitle" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
21
21
  collapsible: Maybe<CollapsibleOption>;
22
22
  decorators: PrintTypeOptions["decorators"];
23
23
  entity: PrintTypeOptions["entity"];
24
24
  exampleSection: PrintTypeOptions["exampleSection"];
25
+ formatMDXTitle: PrintTypeOptions["formatMDXTitle"];
25
26
  groups: Maybe<SchemaEntitiesGroupMap>;
26
27
  level: Maybe<SectionLevelValue>;
27
28
  onlyDocDirectives: GraphQLDirective[];
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,a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AAiB,EAAE,gBAAgB,EAAE,CAAC;CAgCvC,CAAC"}
@@ -59,4 +59,5 @@ exports.DEFAULT_OPTIONS = {
59
59
  formatMDXNameEntity: defaults_1.formatMDXNameEntity,
60
60
  formatMDXPermalink: defaults_1.formatMDXPermalink,
61
61
  formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
62
+ formatMDXTitle: undefined,
62
63
  };
@@ -16,8 +16,14 @@ export declare const DEPRECATED: "deprecated";
16
16
  export declare const NON_NULL: "non-null";
17
17
  /** Default placeholder when no schema description is provided. */
18
18
  export declare const NO_DESCRIPTION_TEXT: "No description";
19
- /** Helper for inserting the code-block end delimiter in generated Markdown. */
20
- export declare const MARKDOWN_EOC: string;
21
- /** Helper for inserting the code-block start delimiter targeting GraphQL syntax. */
22
- export declare const MARKDOWN_SOC: string;
19
+ /**
20
+ * Wraps code in a fenced code block. The fence is longer than any run of
21
+ * backticks in the code, so schema text inside cannot close it early.
22
+ *
23
+ * @param code - the code to wrap.
24
+ * @param language - the fence language, defaults to `graphql`.
25
+ *
26
+ * @returns the fenced code block, surrounded by line breaks.
27
+ */
28
+ export declare const printCodeBlock: (code: string, language?: string) => string;
23
29
  //# sourceMappingURL=strings.d.ts.map
@@ -1 +1 @@
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,yBAAyB,EACzB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAG,YAAqB,CAAC;AAEhD,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,EAAG,UAAmB,CAAC;AAK5C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D,+EAA+E;AAC/E,eAAO,MAAM,YAAY,EAAE,MACwC,CAAC;AAEpE,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,MACkD,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,yBAAyB,EACzB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAG,YAAqB,CAAC;AAEhD,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,EAAG,UAAmB,CAAC;AAK5C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,aACF,MAAM,KACf,MAUF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MARKDOWN_SOC = exports.MARKDOWN_EOC = exports.NO_DESCRIPTION_TEXT = exports.NON_NULL = exports.DEPRECATED = exports.ROOT_TYPE_LOCALE = exports.MARKDOWN_EOP = exports.MARKDOWN_EOL = exports.MARKDOWN_CODE_INDENTATION = void 0;
3
+ exports.printCodeBlock = exports.NO_DESCRIPTION_TEXT = exports.NON_NULL = exports.DEPRECATED = exports.ROOT_TYPE_LOCALE = exports.MARKDOWN_EOP = exports.MARKDOWN_EOL = exports.MARKDOWN_CODE_INDENTATION = void 0;
4
4
  const utils_1 = require("@graphql-markdown/utils");
5
5
  var utils_2 = require("@graphql-markdown/utils");
6
6
  Object.defineProperty(exports, "MARKDOWN_CODE_INDENTATION", { enumerable: true, get: function () { return utils_2.MARKDOWN_CODE_INDENTATION; } });
@@ -30,7 +30,21 @@ exports.NON_NULL = "non-null";
30
30
  const GRAPHQL = "graphql";
31
31
  /** Default placeholder when no schema description is provided. */
32
32
  exports.NO_DESCRIPTION_TEXT = "No description";
33
- /** Helper for inserting the code-block end delimiter in generated Markdown. */
34
- exports.MARKDOWN_EOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${utils_1.MARKDOWN_EOL}`;
35
- /** Helper for inserting the code-block start delimiter targeting GraphQL syntax. */
36
- exports.MARKDOWN_SOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${GRAPHQL}${utils_1.MARKDOWN_EOL}`;
33
+ /**
34
+ * Wraps code in a fenced code block. The fence is longer than any run of
35
+ * backticks in the code, so schema text inside cannot close it early.
36
+ *
37
+ * @param code - the code to wrap.
38
+ * @param language - the fence language, defaults to `graphql`.
39
+ *
40
+ * @returns the fenced code block, surrounded by line breaks.
41
+ */
42
+ const printCodeBlock = (code, language = GRAPHQL) => {
43
+ const char = utils_1.MARKDOWN_CODE_SNIPPET[0];
44
+ const longestRun = Math.max(0, ...(code.match(new RegExp(`${char}+`, "g")) ?? []).map((run) => {
45
+ return run.length;
46
+ }));
47
+ const fence = char.repeat(Math.max(3, longestRun + 1));
48
+ return `${utils_1.MARKDOWN_EOL}${fence}${language}${utils_1.MARKDOWN_EOL}${code}${utils_1.MARKDOWN_EOL}${fence}${utils_1.MARKDOWN_EOL}`;
49
+ };
50
+ exports.printCodeBlock = printCodeBlock;
@@ -14,17 +14,9 @@
14
14
  * to the built-in sections, or into a named slot such as the heading's
15
15
  * metadata line or a member's description.
16
16
  *
17
- * `customDirective` is the deprecated predecessor of this module. It never
18
- * reaches this module, or any other part of the printer: `@graphql-markdown/core`
19
- * converts its schema-resolved directive map into decorator declarations
20
- * (see {@link buildCustomDirectiveDecorators}) once, before the printer is
21
- * ever invoked, so both options flow through the exact same resolve/render
22
- * pipeline below — there is one code path for "select nodes by directive,
23
- * render descriptor text, a badge, or a section", not two.
24
- *
25
17
  * @packageDocumentation
26
18
  */
27
- import type { CustomDirectiveMap, DecoratorDefinition, Decorators, Maybe, PageSection, PageSections, PrintTypeOptions } from "@graphql-markdown/types";
19
+ import type { DecoratorDefinition, Maybe, PageSection, PageSections, PrintTypeOptions } from "@graphql-markdown/types";
28
20
  import { getSchemaEntity } from "@graphql-markdown/graphql";
29
21
  export { getSchemaEntity };
30
22
  /**
@@ -47,47 +39,11 @@ export type ResolvedDecorator = DecoratorDefinition & {
47
39
  * names are reserved.
48
40
  */
49
41
  export declare const RESERVED_SECTION_NAMES: readonly string[];
50
- /**
51
- * Converts the deprecated `customDirective` option's schema-resolved
52
- * directive map into decorator declarations, so it flows through the exact
53
- * same resolve/render pipeline as everything declared under `decorators`.
54
- *
55
- * Called once by `@graphql-markdown/core`, right after `customDirectives` is
56
- * schema-resolved, and merged directly into the top-level `decorators`
57
- * option before it reaches the printer — `customDirective`/`CustomDirectiveMap`
58
- * never reach this printer package otherwise; only the three decorators
59
- * built here do, indistinguishable from any other `decorators` entry except
60
- * for their reserved ids (see {@link CUSTOM_DIRECTIVE_DECORATOR_IDS}).
61
- *
62
- * Returns three entries:
63
- * - `customDirectives`: the built-in "Directives" section, listing every
64
- * custom directive declared on a type, positioned right after `code`
65
- * (its fixed position in the pre-decorators built-in section order).
66
- * - `customDirective:description`: `customDirective`'s `descriptor`
67
- * handlers, appended as description text (`position: { into: "description" }`).
68
- * - `customDirective:tags`: `customDirective`'s `tag` handlers, rendered as
69
- * badges in the metadata line (`position: { into: "tags" }`).
70
- *
71
- * All three share one `resolve`, reading every custom directive matched on
72
- * a node, in schema declaration order. Matching (including wildcard `"*"`
73
- * precedence — a named handler wins over `"*"`) is already resolved by
74
- * `getConstDirectiveMap` (fed by `@graphql-markdown/graphql`'s
75
- * `getCustomDirectives`, which expands a wildcard into concrete
76
- * per-directive entries upstream), so this reuses that resolution rather
77
- * than re-implementing it against the generic predicate system.
78
- *
79
- * @param customDirectives - the schema-resolved `customDirective` map, or
80
- * `undefined`/empty when the option is not in use.
81
- *
82
- * @returns the three decorators, or `{}` when `customDirectives` is empty.
83
- *
84
- */
85
- export declare const buildCustomDirectiveDecorators: (customDirectives: Maybe<CustomDirectiveMap>) => Decorators;
86
42
  /**
87
43
  * Builds the example section as a decorator definition.
88
44
  *
89
45
  * The example section is a specialized decorator: it is driven by a schema
90
- * directive, named by [`printTypeOptions.exampleSection`](https://graphql-markdown.dev/docs/settings#printtypeoptions),
46
+ * directive, named by [`printTypeOptions.exampleSection`](https://graphql-markdown.dev/docs/reference/settings#printtypeoptions),
91
47
  * and rendered as a code block.
92
48
  *
93
49
  * It resolves its own value rather than gating on a directive by name,
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../src/decorator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAEV,kBAAkB,EAIlB,mBAAmB,EACnB,UAAU,EAEV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAGL,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAgBnC,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG;IACpD,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAa1C,CAAC;AA8EX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,8BAA8B,qBACvB,KAAK,CAAC,kBAAkB,CAAC,KAC1C,UAqFF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,2BAA2B,QAAO,iBAe9C,CAAC;AA4FF;;;;;;;;;;;;GAYG;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CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,QACN,OAAO,WACJ,gBAAgB,KACxB,MAAM,EAcR,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,iBACf,SAAS,MAAM,EAAE,WACtB,gBAAgB,KACxB,MAAM,EAuBR,CAAC"}
package/dist/decorator.js CHANGED
@@ -15,26 +15,14 @@
15
15
  * to the built-in sections, or into a named slot such as the heading's
16
16
  * metadata line or a member's description.
17
17
  *
18
- * `customDirective` is the deprecated predecessor of this module. It never
19
- * reaches this module, or any other part of the printer: `@graphql-markdown/core`
20
- * converts its schema-resolved directive map into decorator declarations
21
- * (see {@link buildCustomDirectiveDecorators}) once, before the printer is
22
- * ever invoked, so both options flow through the exact same resolve/render
23
- * pipeline below — there is one code path for "select nodes by directive,
24
- * render descriptor text, a badge, or a section", not two.
25
- *
26
18
  * @packageDocumentation
27
19
  */
28
20
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getDecoratorsOrder = exports.printSlotDecorators = exports.printDecorators = exports.printDecorator = exports.getExampleSectionDefinition = exports.buildCustomDirectiveDecorators = exports.RESERVED_SECTION_NAMES = exports.getSchemaEntity = void 0;
21
+ exports.getDecoratorsOrder = exports.printSlotDecorators = exports.printDecorators = exports.printDecorator = exports.getExampleSectionDefinition = exports.RESERVED_SECTION_NAMES = exports.getSchemaEntity = void 0;
30
22
  const graphql_1 = require("@graphql-markdown/graphql");
31
23
  Object.defineProperty(exports, "getSchemaEntity", { enumerable: true, get: function () { return graphql_1.getSchemaEntity; } });
32
- const utils_1 = require("@graphql-markdown/utils");
33
- const badge_ts_1 = require("./badge.js");
34
24
  const example_ts_1 = require("./example.js");
35
- const link_ts_1 = require("./link.js");
36
25
  const strings_ts_1 = require("./const/strings.js");
37
- const options_ts_1 = require("./const/options.js");
38
26
  /**
39
27
  * Section/decorator keys owned by the printer, which a decorator cannot claim.
40
28
  *
@@ -49,177 +37,19 @@ exports.RESERVED_SECTION_NAMES = [
49
37
  "header",
50
38
  "metatags",
51
39
  "mdxDeclaration",
40
+ "title",
52
41
  "tags",
53
42
  "description",
54
43
  "code",
55
- "customDirectives",
56
- "customDirective:description",
57
- "customDirective:tags",
58
44
  "metadata",
59
45
  "example",
60
46
  "relations",
61
47
  ];
62
- /**
63
- * Ids {@link buildCustomDirectiveDecorators} assigns to its three adapter
64
- * decorators. Reserved above so a user's own `decorators` config can't claim
65
- * them, but exempted from `getDeclaredDecorators`'s reserved-id filter so
66
- * `@graphql-markdown/core` can merge the converter's own output for these
67
- * ids directly into `options.decorators`.
68
- *
69
- * @internal
70
- */
71
- const CUSTOM_DIRECTIVE_DECORATOR_IDS = [
72
- "customDirectives",
73
- "customDirective:description",
74
- "customDirective:tags",
75
- ];
76
- /**
77
- * Resolves a custom directive handler's return value.
78
- *
79
- * Internal to {@link buildCustomDirectiveDecorators}'s render closures; not
80
- * itself user-facing — see `ConfigOptions.customDirective` for the setting.
81
- *
82
- * @param resolver - The resolver function name to execute
83
- * @param type - The GraphQL type to resolve the directive for
84
- * @param constDirectiveOption - The directive configuration options
85
- * @param fallback - Optional fallback value if resolution fails
86
- * @returns The resolved directive value or `fallback`/`undefined`
87
- *
88
- * @internal
89
- */
90
- const getCustomDirectiveResolver = (resolver, type, constDirectiveOption, fallback) => {
91
- if (typeof constDirectiveOption.type !== "object" ||
92
- typeof constDirectiveOption[resolver] !== "function") {
93
- return fallback;
94
- }
95
- return constDirectiveOption[resolver](constDirectiveOption.type, type);
96
- };
97
- /**
98
- * Prints a single custom directive entry as a Markdown string, for the
99
- * built-in "Directives" section.
100
- *
101
- * @internal
102
- */
103
- const printCustomDirective = (type, constDirectiveOption, options) => {
104
- const typeNameLink = (0, link_ts_1.printLink)(constDirectiveOption.type, {
105
- ...options,
106
- withAttributes: false,
107
- });
108
- const description = getCustomDirectiveResolver("descriptor", type, constDirectiveOption);
109
- if (typeof description !== "string") {
110
- return undefined;
111
- }
112
- return `${options_ts_1.SectionLevels.LEVEL.repeat(4)} ${typeNameLink}${strings_ts_1.MARKDOWN_EOL} ${description}${strings_ts_1.MARKDOWN_EOL} `;
113
- };
114
- /**
115
- * Converts the deprecated `customDirective` option's schema-resolved
116
- * directive map into decorator declarations, so it flows through the exact
117
- * same resolve/render pipeline as everything declared under `decorators`.
118
- *
119
- * Called once by `@graphql-markdown/core`, right after `customDirectives` is
120
- * schema-resolved, and merged directly into the top-level `decorators`
121
- * option before it reaches the printer — `customDirective`/`CustomDirectiveMap`
122
- * never reach this printer package otherwise; only the three decorators
123
- * built here do, indistinguishable from any other `decorators` entry except
124
- * for their reserved ids (see {@link CUSTOM_DIRECTIVE_DECORATOR_IDS}).
125
- *
126
- * Returns three entries:
127
- * - `customDirectives`: the built-in "Directives" section, listing every
128
- * custom directive declared on a type, positioned right after `code`
129
- * (its fixed position in the pre-decorators built-in section order).
130
- * - `customDirective:description`: `customDirective`'s `descriptor`
131
- * handlers, appended as description text (`position: { into: "description" }`).
132
- * - `customDirective:tags`: `customDirective`'s `tag` handlers, rendered as
133
- * badges in the metadata line (`position: { into: "tags" }`).
134
- *
135
- * All three share one `resolve`, reading every custom directive matched on
136
- * a node, in schema declaration order. Matching (including wildcard `"*"`
137
- * precedence — a named handler wins over `"*"`) is already resolved by
138
- * `getConstDirectiveMap` (fed by `@graphql-markdown/graphql`'s
139
- * `getCustomDirectives`, which expands a wildcard into concrete
140
- * per-directive entries upstream), so this reuses that resolution rather
141
- * than re-implementing it against the generic predicate system.
142
- *
143
- * @param customDirectives - the schema-resolved `customDirective` map, or
144
- * `undefined`/empty when the option is not in use.
145
- *
146
- * @returns the three decorators, or `{}` when `customDirectives` is empty.
147
- *
148
- */
149
- const buildCustomDirectiveDecorators = (customDirectives) => {
150
- if (typeof customDirectives !== "object" ||
151
- customDirectives === null ||
152
- Object.keys(customDirectives).length === 0) {
153
- return {};
154
- }
155
- const resolve = (type) => {
156
- const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, customDirectives);
157
- return constDirectiveMap
158
- ? Object.values(constDirectiveMap)
159
- : [];
160
- };
161
- return {
162
- customDirectives: {
163
- title: "Directives",
164
- predicate: (0, graphql_1.always)(),
165
- resolve,
166
- position: { after: "code" },
167
- render: (values, options, context) => {
168
- const directives = values
169
- .map((item) => {
170
- return printCustomDirective(context.type, item, options);
171
- })
172
- .filter((value) => {
173
- return value !== undefined;
174
- });
175
- return directives.length > 0
176
- ? directives.join(strings_ts_1.MARKDOWN_EOP)
177
- : undefined;
178
- },
179
- },
180
- "customDirective:description": {
181
- predicate: (0, graphql_1.always)(),
182
- resolve,
183
- position: { into: "description" },
184
- render: (values, _options, context) => {
185
- const parts = values
186
- .map((item) => {
187
- return getCustomDirectiveResolver("descriptor", context.type, item, "");
188
- })
189
- .filter((text) => {
190
- return typeof text === "string" && text.length > 0;
191
- })
192
- .map((text) => {
193
- return (0, utils_1.escapeMDX)(text);
194
- });
195
- return parts.length > 0 ? parts.join(strings_ts_1.MARKDOWN_EOP) : undefined;
196
- },
197
- },
198
- "customDirective:tags": {
199
- predicate: (0, graphql_1.always)(),
200
- resolve,
201
- position: { into: "tags" },
202
- render: (values, options, context) => {
203
- const badges = values
204
- .map((item) => {
205
- return getCustomDirectiveResolver("tag", context.type, item);
206
- })
207
- .filter((value) => {
208
- return value !== undefined;
209
- });
210
- return badges.length > 0
211
- ? (0, badge_ts_1.formatBadges)(badges, options)
212
- : undefined;
213
- },
214
- },
215
- };
216
- };
217
- exports.buildCustomDirectiveDecorators = buildCustomDirectiveDecorators;
218
48
  /**
219
49
  * Builds the example section as a decorator definition.
220
50
  *
221
51
  * The example section is a specialized decorator: it is driven by a schema
222
- * directive, named by [`printTypeOptions.exampleSection`](https://graphql-markdown.dev/docs/settings#printtypeoptions),
52
+ * directive, named by [`printTypeOptions.exampleSection`](https://graphql-markdown.dev/docs/reference/settings#printtypeoptions),
223
53
  * and rendered as a code block.
224
54
  *
225
55
  * It resolves its own value rather than gating on a directive by name,
@@ -248,7 +78,7 @@ const getExampleSectionDefinition = () => {
248
78
  return example ? [{ example }] : [];
249
79
  },
250
80
  render: (values) => {
251
- return `${strings_ts_1.MARKDOWN_SOC}${values[0].example}${strings_ts_1.MARKDOWN_EOC}`;
81
+ return (0, strings_ts_1.printCodeBlock)(values[0].example);
252
82
  },
253
83
  };
254
84
  };
@@ -351,18 +181,8 @@ const printDecorator = (type, decorator, options) => {
351
181
  exports.printDecorator = printDecorator;
352
182
  /**
353
183
  * Returns the decorators to build, in declaration order, from the top-level
354
- * `decorators` option. `@graphql-markdown/core` merges `customDirective`'s
355
- * adapter decorators (see {@link buildCustomDirectiveDecorators}) into this
356
- * same option before it reaches the printer, so this reads a single source,
357
- * with no separate customDirective-specific path.
358
- *
359
- * Every entry is filtered against reserved ids, except the adapter's own —
360
- * see {@link CUSTOM_DIRECTIVE_DECORATOR_IDS} — since those are assigned by
361
- * the converter, not user config, and are reserved specifically to keep user
362
- * config from claiming them. A user-declared decorator claiming any other
363
- * reserved id is still dropped: the printer is reachable directly through
364
- * its public API, bypassing configuration validation, and such a decorator
365
- * would otherwise overwrite a built-in section.
184
+ * `decorators` option.
185
+ *
366
186
  *
367
187
  * @internal
368
188
  *
@@ -378,8 +198,7 @@ const getDeclaredDecorators = (options) => {
378
198
  return decorators
379
199
  ? Object.entries(decorators)
380
200
  .filter(([id]) => {
381
- return (!exports.RESERVED_SECTION_NAMES.includes(id) ||
382
- CUSTOM_DIRECTIVE_DECORATOR_IDS.includes(id));
201
+ return !exports.RESERVED_SECTION_NAMES.includes(id);
383
202
  })
384
203
  .map(([id, decorator]) => {
385
204
  return { ...decorator, id };
@@ -5,9 +5,12 @@
5
5
  import type { PrintTypeOptions, PageSection, Maybe } from "@graphql-markdown/types";
6
6
  /**
7
7
  * Generates markdown documentation for a scalar type's specification URL.
8
+ * Only absolute http(s) URLs are printed; the URL is normalized (`URL#href`, which
9
+ * percent-encodes characters such as `"`, `<`, `>` and spaces). Any other value
10
+ * prints no specification section.
8
11
  * @param type - The GraphQL scalar type object
9
12
  * @param options - Options for printing type information
10
- * @returns A specification PageSection, or undefined when no URL exists
13
+ * @returns A specification PageSection, or undefined when no valid http(s) URL exists
11
14
  */
12
15
  export declare const printSpecification: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection>;
13
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/graphql/scalar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,EACN,MAAM,yBAAyB,CAAC;AAIjC;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,SACvB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAgBnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,SACxB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAEnB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,YACH,gBAAgB,KACzB,MAEF,CAAC"}
1
+ {"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/graphql/scalar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,EACN,MAAM,yBAAyB,CAAC;AAMjC;;;;;;;;GAQG;AAEH,eAAO,MAAM,kBAAkB,SACvB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAyBnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,SACxB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAEnB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,YACH,gBAAgB,KACzB,MAEF,CAAC"}
@@ -2,13 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.printCodeScalar = exports.printScalarMetadata = exports.printSpecification = void 0;
4
4
  const graphql_1 = require("@graphql-markdown/graphql");
5
+ const SPECIFIED_BY_PROTOCOLS = new Set(["http:", "https:"]);
5
6
  /**
6
7
  * Generates markdown documentation for a scalar type's specification URL.
8
+ * Only absolute http(s) URLs are printed; the URL is normalized (`URL#href`, which
9
+ * percent-encodes characters such as `"`, `<`, `>` and spaces). Any other value
10
+ * prints no specification section.
7
11
  * @param type - The GraphQL scalar type object
8
12
  * @param options - Options for printing type information
9
- * @returns A specification PageSection, or undefined when no URL exists
13
+ * @returns A specification PageSection, or undefined when no valid http(s) URL exists
10
14
  */
11
- // Used only by unit tests for direct whitebox coverage; not part of the production public API.
15
+ // Exported for direct unit testing; reached in production through printScalarMetadata.
12
16
  const printSpecification = (type, options) => {
13
17
  if (typeof type !== "object" ||
14
18
  type === null ||
@@ -16,9 +20,19 @@ const printSpecification = (type, options) => {
16
20
  typeof type.specifiedByURL !== "string") {
17
21
  return undefined;
18
22
  }
19
- const url = type.specifiedByURL;
23
+ let href;
24
+ try {
25
+ const parsed = new URL(type.specifiedByURL);
26
+ if (!SPECIFIED_BY_PROTOCOLS.has(parsed.protocol)) {
27
+ return undefined;
28
+ }
29
+ href = parsed.href;
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
20
34
  return {
21
- title: options.formatMDXSpecifiedByLink(url),
35
+ title: options.formatMDXSpecifiedByLink(href),
22
36
  level: 3,
23
37
  };
24
38
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Printer } from "./printer.ts";
2
- export { buildCustomDirectiveDecorators, RESERVED_SECTION_NAMES, } from "./decorator.ts";
2
+ export { RESERVED_SECTION_NAMES } from "./decorator.ts";
3
+ export { toLink } from "./link.ts";
3
4
  export { PrintCodeEvent, PrintTypeEvent, BeforeComposePageTypeEvent, } from "./events.ts";
4
5
  export type { PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, ComposePageTypeEventData, } from "./events.ts";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BeforeComposePageTypeEvent = exports.PrintTypeEvent = exports.PrintCodeEvent = exports.RESERVED_SECTION_NAMES = exports.buildCustomDirectiveDecorators = exports.Printer = void 0;
3
+ exports.BeforeComposePageTypeEvent = exports.PrintTypeEvent = exports.PrintCodeEvent = exports.toLink = exports.RESERVED_SECTION_NAMES = exports.Printer = void 0;
4
4
  var printer_ts_1 = require("./printer.js");
5
5
  Object.defineProperty(exports, "Printer", { enumerable: true, get: function () { return printer_ts_1.Printer; } });
6
6
  var decorator_ts_1 = require("./decorator.js");
7
- Object.defineProperty(exports, "buildCustomDirectiveDecorators", { enumerable: true, get: function () { return decorator_ts_1.buildCustomDirectiveDecorators; } });
8
7
  Object.defineProperty(exports, "RESERVED_SECTION_NAMES", { enumerable: true, get: function () { return decorator_ts_1.RESERVED_SECTION_NAMES; } });
8
+ var link_ts_1 = require("./link.js");
9
+ Object.defineProperty(exports, "toLink", { enumerable: true, get: function () { return link_ts_1.toLink; } });
9
10
  var events_ts_1 = require("./events.js");
10
11
  Object.defineProperty(exports, "PrintCodeEvent", { enumerable: true, get: function () { return events_ts_1.PrintCodeEvent; } });
11
12
  Object.defineProperty(exports, "PrintTypeEvent", { enumerable: true, get: function () { return events_ts_1.PrintTypeEvent; } });
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAKhB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAiCjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,YACH,IAAI,CACZ,gBAAgB,EAChB,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CACzD,KACA,OAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,KAAK,CAAC,UAAU,CAoBjE,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,oBACK,KAAK,CAAC,UAAU,CAAC,KAClC,KAAK,CAAC,MAAM,CAoBd,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,uBAAuB,YAAa,gBAAgB,KAAG,OAEnE,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,YAAa,gBAAgB,KAAG,OAO/D,CAAC;AAEF;;;;;;GA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;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,oBACK,KAAK,CAAC,UAAU,CAAC,KAClC,KAAK,CAAC,MAAM,CAoBd,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,uBAAuB,YAAa,gBAAgB,KAAG,OAEnE,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,YAAa,gBAAgB,KAAG,OAO/D,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,WACJ,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAC7C,MAMF,CAAC;AA2DF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,SACX,OAAO,QACP,MAAM,aACD,KAAK,CAAC,UAAU,CAAC,WACnB,gBAAgB,KACxB,QAkGF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,aAChB,KAAK,CAAC,UAAU,CAAC,QACrB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,QAAQ,CAUhB,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,mBAAmB,SACxB,OAAO,SACP,KAAK,CAAC,MAAM,CAAC,KAClB,MAkBF,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,OACpB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,WACf,gBAAgB,KACxB,MAqCF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAWd,CAAC"}
package/dist/link.js CHANGED
@@ -330,8 +330,13 @@ const printLink = (arg, options) => {
330
330
  const printFormattedLink = (text, link) => {
331
331
  // create a permalink if url is not provided or is just a hash
332
332
  if ((!link.url || link.url === "#") && typeof link.id === "string") {
333
- const linkUrl = options.sectionHeaderId ? link.id : "";
334
- return `[${text}](#${linkUrl})`;
333
+ // without section header ids, the heading id is generated by the
334
+ // framework from the whole heading text (badges included), so there is
335
+ // no known anchor to link to: print the text alone, not a dead `#` link
336
+ if (!options.sectionHeaderId) {
337
+ return text;
338
+ }
339
+ return `[${text}](#${link.id})`;
335
340
  }
336
341
  return `[${text}](${link.url})`;
337
342
  };
package/dist/printer.d.ts CHANGED
@@ -78,6 +78,17 @@ export declare class Printer implements IPrinter {
78
78
  * @returns Formatted header string with optional frontmatter
79
79
  */
80
80
  static readonly printHeader: (id: string, title: string, options: PrintTypeOptions) => string;
81
+ /**
82
+ * Prints the visible page title, using the formatter `formatMDXTitle`.
83
+ *
84
+ * Independent of the frontmatter: frameworks that render the frontmatter
85
+ * `title` themselves provide no `formatMDXTitle`, and nothing is printed.
86
+ *
87
+ * @param title - Display title for the type
88
+ * @param options - Printer configuration options
89
+ * @returns Formatted page title, or an empty string
90
+ */
91
+ static readonly printTitle: (title: string, options: PrintTypeOptions) => string;
81
92
  /**
82
93
  * Prints the GraphQL type definition as code block
83
94
  *
@@ -1 +1 @@
1
- {"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,KAAK,EAEL,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,EACL,SAAS,EACT,WAAW,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AAiDjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAIL,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AAsFxB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,gBAAgB,CAAoB;IAE7E;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,eAAe,CAAmB;IAE1E,OAAO,CAAC,MAAM,CAAC,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xDeclaration",
29
+ "title",
29
30
  ];
30
31
  const TYPE_PAGE_SECTION_ORDER = [
31
32
  "tags",
@@ -201,11 +202,25 @@ class Printer {
201
202
  */
202
203
  static printHeader = (id, title, options) => {
203
204
  if (options.frontMatter === false) {
204
- return `# ${title}${strings_ts_1.MARKDOWN_EOP}`;
205
+ // the formatter page title, if any, is printed by `printTitle`
206
+ return options.formatMDXTitle ? "" : `# ${title}${strings_ts_1.MARKDOWN_EOP}`;
205
207
  }
206
208
  const fmOptions = options.frontMatter ?? options_ts_1.DEFAULT_OPTIONS.frontMatter;
207
209
  return (0, frontmatter_ts_1.printFrontMatter)(title, { ...fmOptions, id }, options);
208
210
  };
211
+ /**
212
+ * Prints the visible page title, using the formatter `formatMDXTitle`.
213
+ *
214
+ * Independent of the frontmatter: frameworks that render the frontmatter
215
+ * `title` themselves provide no `formatMDXTitle`, and nothing is printed.
216
+ *
217
+ * @param title - Display title for the type
218
+ * @param options - Printer configuration options
219
+ * @returns Formatted page title, or an empty string
220
+ */
221
+ static printTitle = (title, options) => {
222
+ return options.formatMDXTitle?.(title) ?? "";
223
+ };
209
224
  /**
210
225
  * Prints the GraphQL type definition as code block
211
226
  *
@@ -243,7 +258,7 @@ class Printer {
243
258
  default:
244
259
  code = `"${(0, graphql_1.getTypeName)(type)}" not supported`;
245
260
  }
246
- return strings_ts_1.MARKDOWN_SOC + code.trim() + strings_ts_1.MARKDOWN_EOC;
261
+ return (0, strings_ts_1.printCodeBlock)(code.trim());
247
262
  };
248
263
  /**
249
264
  * Formats a single badge into MDX string format
@@ -422,9 +437,6 @@ class Printer {
422
437
  // can add, remove, or reorder them at will.
423
438
  // See: https://github.com/graphql-markdown/graphql-markdown/issues/2954
424
439
  const code = await Printer.printCodeAsync(type, name, printTypeOptions);
425
- // `customDirective`'s `tag` handlers reach this line via the decorators
426
- // pipeline (`printSlotDecorators`, not a dedicated call) — see
427
- // `buildCustomDirectiveDecorators` in `./decorator`.
428
440
  const tags = (0, decorator_ts_1.printSlotDecorators)("tags", type, printTypeOptions)
429
441
  .filter(Boolean)
430
442
  .join(" ");
@@ -433,9 +445,7 @@ class Printer {
433
445
  const example = Printer.printExample(type, printTypeOptions);
434
446
  // Create sections map for composition events. The built-in "Directives"
435
447
  // section reaches this map via the `...Printer.printDecorators(...)`
436
- // spread below (it is `customDirective`'s adapter, unconditionally
437
- // present under the reserved `customDirectives` id — see
438
- // `buildCustomDirectiveDecorators`), not a dedicated field here.
448
+ // spread below, not a dedicated field here.
439
449
  const sections = {
440
450
  header: { content: header },
441
451
  metatags: { content: metatags },
@@ -448,6 +458,11 @@ class Printer {
448
458
  relations: Printer.normalizePageSection(relations),
449
459
  ...Printer.printDecorators(type, printTypeOptions),
450
460
  };
461
+ // The visible page title follows the header sections (frontmatter,
462
+ // metatags and MDX imports), whatever the frontmatter option.
463
+ sections.title = {
464
+ content: Printer.printTitle((0, graphql_1.getTypeName)(type), printTypeOptions),
465
+ };
451
466
  let sectionOrder = (0, decorator_ts_1.getDecoratorsOrder)(TYPE_PAGE_SECTION_ORDER, printTypeOptions);
452
467
  // Emit BEFORE_COMPOSE_PAGE_TYPE event if emitter is configured
453
468
  if (Printer.eventEmitter) {
@@ -1 +1 @@
1
- {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,KAAK,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AA8CjC;;;;;;;;GAQG;AAEH,eAAO,MAAM,gBAAgB,GAAI,CAAC,QAC1B,CAAC,WACE,gBAAgB,KACxB,SAAS,GAAG,MAmEd,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,GAAI,CAAC,UACzB,CAAC,GAAG,CAAC,EAAE,WACN,gBAAgB,KACxB,SAAS,GAAG,MAiBd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,UACpB,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,WACjB,MAAM,WACN,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAmCnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,QACjC,CAAC,UACC,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,WACrB,MAAM,WACN,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAqEnB,CAAC"}
1
+ {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,KAAK,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AA8CjC;;;;;;;;GAQG;AAEH,eAAO,MAAM,gBAAgB,GAAI,CAAC,QAC1B,CAAC,WACE,gBAAgB,KACxB,SAAS,GAAG,MAgEd,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,GAAI,CAAC,UACzB,CAAC,GAAG,CAAC,EAAE,WACN,gBAAgB,KACxB,SAAS,GAAG,MAiBd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,UACpB,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,WACjB,MAAM,WACN,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAmCnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,QACjC,CAAC,UACC,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,WACrB,MAAM,WACN,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAqEnB,CAAC"}
package/dist/section.js CHANGED
@@ -28,7 +28,7 @@ const printPermalink = (id, options) => {
28
28
  return undefined;
29
29
  }
30
30
  const format = options.formatMDXPermalink ?? options_ts_1.DEFAULT_OPTIONS.formatMDXPermalink;
31
- return format(id);
31
+ return format(id, options.meta);
32
32
  };
33
33
  /**
34
34
  * Prints a single section item with its associated metadata.
@@ -56,9 +56,6 @@ const printSectionItem = (type, options) => {
56
56
  ]
57
57
  .filter(Boolean)
58
58
  .join(" ");
59
- // `customDirective`'s `tag` handlers reach this line via the decorators
60
- // pipeline (`printSlotDecorators`), not a dedicated call — see
61
- // `buildCustomDirectiveDecorators` in `./decorator`.
62
59
  const tags = (0, decorator_ts_1.printSlotDecorators)("tags", type, options)
63
60
  .filter(Boolean)
64
61
  .join(" ");
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.19.4",
8
+ "version": "1.21.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -65,10 +65,10 @@
65
65
  "test:watch": "vitest --watch"
66
66
  },
67
67
  "dependencies": {
68
- "@graphql-markdown/formatters": "^1.2.2",
69
- "@graphql-markdown/graphql": "^1.3.5",
70
- "@graphql-markdown/types": "^1.17.1",
71
- "@graphql-markdown/utils": "^1.14.2"
68
+ "@graphql-markdown/formatters": "^1.3.0",
69
+ "@graphql-markdown/graphql": "^1.4.0",
70
+ "@graphql-markdown/types": "^1.19.0",
71
+ "@graphql-markdown/utils": "^1.14.4"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@graphql-markdown/tooling-config": "^1.0.0"