@graphql-markdown/formatters 1.1.3 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,8 +14,8 @@ exports.afterRenderFilesHook = exports.createMDXFormatter = exports.afterRenderT
14
14
  const node_path_1 = require("node:path");
15
15
  const helpers_1 = require("@graphql-markdown/helpers");
16
16
  const utils_1 = require("@graphql-markdown/utils");
17
- const defaults_1 = require("../defaults");
18
- const output_1 = require("../output");
17
+ const defaults_ts_1 = require("../defaults.js");
18
+ const output_ts_1 = require("../output.js");
19
19
  /**
20
20
  * Formats a badge as Markdown bold text — mdBook has no badge component.
21
21
  * @param badge - Badge data containing text
@@ -61,7 +61,7 @@ exports.formatMDXDetails = formatMDXDetails;
61
61
  * @returns `# Title\n` when a title is available, otherwise an empty string
62
62
  */
63
63
  const formatMDXFrontmatter = (_props, formatted) => {
64
- return (0, defaults_1.formatMDXFrontmatterTitleOnly)(formatted, true);
64
+ return (0, defaults_ts_1.formatMDXFrontmatterTitleOnly)(formatted, true);
65
65
  };
66
66
  exports.formatMDXFrontmatter = formatMDXFrontmatter;
67
67
  /** mdBook expects `.md` files; override the default `.mdx` extension. */
@@ -82,24 +82,12 @@ const formatMDXLink = (link) => {
82
82
  };
83
83
  };
84
84
  exports.formatMDXLink = formatMDXLink;
85
- var defaults_2 = require("../defaults");
86
- Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
87
- Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_2.formatMDXNameEntity; } });
88
- Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_2.formatMDXPermalink; } });
89
- Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
90
- const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
91
- return content.replaceAll(/\]\((\/[^)\s#]+)(#[^)\s]+)?\)/g, (_match, urlPath, hash = "") => {
92
- const relativePath = (0, utils_1.toRelativeGeneratedDocLink)({
93
- baseURL,
94
- currentFilePath: filePath,
95
- extension: exports.mdxExtension,
96
- outputDir,
97
- targetUrlPath: urlPath,
98
- });
99
- const target = relativePath ?? urlPath;
100
- return `](${target}${hash})`;
101
- });
102
- };
85
+ var defaults_ts_2 = require("../defaults.js");
86
+ Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_ts_2.formatMDXBullet; } });
87
+ Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_ts_2.formatMDXNameEntity; } });
88
+ Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_ts_2.formatMDXPermalink; } });
89
+ Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_ts_2.formatMDXSpecifiedByLink; } });
90
+ const rewriteInternalLinks = (0, output_ts_1.createInternalLinksRewriter)(exports.mdxExtension);
103
91
  /**
104
92
  * Rewrites absolute generated doc links to page-relative `.md` paths after each page is rendered.
105
93
  *
@@ -111,7 +99,7 @@ const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
111
99
  * work correctly regardless of where the book is hosted.
112
100
  */
113
101
  const afterRenderTypeEntitiesHook = async (event) => {
114
- await (0, output_1.rewriteRenderedPage)(event, rewriteInternalLinks);
102
+ await (0, output_ts_1.rewriteRenderedPage)(event, rewriteInternalLinks);
115
103
  };
116
104
  exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
117
105
  /**
@@ -123,13 +111,13 @@ const createMDXFormatter = (_meta) => {
123
111
  return {
124
112
  formatMDXBadge: exports.formatMDXBadge,
125
113
  formatMDXAdmonition: exports.formatMDXAdmonition,
126
- formatMDXBullet: defaults_1.formatMDXBullet,
114
+ formatMDXBullet: defaults_ts_1.formatMDXBullet,
127
115
  formatMDXDetails: exports.formatMDXDetails,
128
116
  formatMDXFrontmatter: exports.formatMDXFrontmatter,
129
117
  formatMDXLink: exports.formatMDXLink,
130
- formatMDXNameEntity: defaults_1.formatMDXNameEntity,
131
- formatMDXPermalink: defaults_1.formatMDXPermalink,
132
- formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
118
+ formatMDXNameEntity: defaults_ts_1.formatMDXNameEntity,
119
+ formatMDXPermalink: defaults_ts_1.formatMDXPermalink,
120
+ formatMDXSpecifiedByLink: defaults_ts_1.formatMDXSpecifiedByLink,
133
121
  };
134
122
  };
135
123
  exports.createMDXFormatter = createMDXFormatter;
@@ -200,6 +188,6 @@ const afterRenderFilesHook = async (event) => {
200
188
  }
201
189
  lines.push("");
202
190
  }
203
- await (0, output_1.writeOutput)(summaryPath, lines.join("\n"), outputAdapter);
191
+ await (0, output_ts_1.writeOutput)(summaryPath, lines.join("\n"), outputAdapter);
204
192
  };
205
193
  exports.afterRenderFilesHook = afterRenderFilesHook;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Generic MDX formatter for GraphQL documentation output.
3
+ *
4
+ * Produces framework-neutral `.mdx` pages: plain Markdown and JSX-safe HTML,
5
+ * with no framework components and no `import` declarations.
6
+ * Header permalinks are escaped (`\{#id\}`) so that they remain valid MDX.
7
+ * YAML front matter is kept, and internal links are rewritten to page-relative paths.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import type { AdmonitionType, CollapsibleOption, Formatter, Maybe, MDXString, MetaInfo, RenderTypeEntitiesHook, TypeLink } from "@graphql-markdown/types";
12
+ import { formatMDXBadge, formatMDXBullet, formatMDXEscapedPermalink, formatMDXFrontmatter, formatMDXNameEntity, formatMDXSpecifiedByLink } from "../defaults.ts";
13
+ /** Generic MDX pages use the `.mdx` extension. */
14
+ export declare const mdxExtension = ".mdx";
15
+ /**
16
+ * Formats an admonition as a Markdown blockquote with a bold type/title label.
17
+ * @param admonition - Admonition data with text, title, and type
18
+ * @param _meta - Unused metadata parameter
19
+ * @returns Formatted admonition string
20
+ */
21
+ export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, _meta: Maybe<MetaInfo>) => MDXString;
22
+ /**
23
+ * Formats a collapsible block as an HTML `<details>` element.
24
+ * The output is split on `\r` by the printer into [openSection, closeSection].
25
+ * @param option - Configuration for open/close label text
26
+ * @returns Formatted collapsible string
27
+ */
28
+ export declare const formatMDXDetails: ({ dataOpen, dataClose, }: CollapsibleOption) => MDXString;
29
+ /**
30
+ * Rewrites extensionless absolute links so they point to `.mdx` pages.
31
+ * @param link - Link data with URL and text
32
+ * @returns The link with `.mdx` appended to extensionless absolute paths
33
+ */
34
+ export declare const formatMDXLink: (link: TypeLink) => TypeLink;
35
+ export { formatMDXBadge, formatMDXBullet, formatMDXFrontmatter, formatMDXNameEntity, formatMDXSpecifiedByLink, };
36
+ /**
37
+ * Formats a header permalink with escaped braces (`\{#id\}`), valid in MDX.
38
+ * @param id - The ID of the section header
39
+ * @returns Escaped permalink string
40
+ */
41
+ export declare const formatMDXPermalink: typeof formatMDXEscapedPermalink;
42
+ /**
43
+ * Rewrites absolute generated doc links to page-relative `.mdx` paths after each page is rendered.
44
+ */
45
+ export declare const afterRenderTypeEntitiesHook: RenderTypeEntitiesHook;
46
+ /**
47
+ * Creates a generic MDX formatter.
48
+ * @param _meta - Unused metadata parameter
49
+ * @returns A complete {@link Formatter} implementation for generic MDX output
50
+ */
51
+ export declare const createMDXFormatter: (_meta?: Maybe<MetaInfo>) => Formatter;
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EACL,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,gBAAgB,CAAC;AAGxB,kDAAkD;AAClD,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAU9C,CAAC;AAEF,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,yBACb,CAAC;AAI5B;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBAIzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /**
3
+ * Generic MDX formatter for GraphQL documentation output.
4
+ *
5
+ * Produces framework-neutral `.mdx` pages: plain Markdown and JSX-safe HTML,
6
+ * with no framework components and no `import` declarations.
7
+ * Header permalinks are escaped (`\{#id\}`) so that they remain valid MDX.
8
+ * YAML front matter is kept, and internal links are rewritten to page-relative paths.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.createMDXFormatter = exports.afterRenderTypeEntitiesHook = exports.formatMDXPermalink = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXBullet = exports.formatMDXBadge = exports.formatMDXLink = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.mdxExtension = void 0;
14
+ const helpers_1 = require("@graphql-markdown/helpers");
15
+ const utils_1 = require("@graphql-markdown/utils");
16
+ const defaults_ts_1 = require("../defaults.js");
17
+ Object.defineProperty(exports, "formatMDXBadge", { enumerable: true, get: function () { return defaults_ts_1.formatMDXBadge; } });
18
+ Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_ts_1.formatMDXBullet; } });
19
+ Object.defineProperty(exports, "formatMDXFrontmatter", { enumerable: true, get: function () { return defaults_ts_1.formatMDXFrontmatter; } });
20
+ Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_ts_1.formatMDXNameEntity; } });
21
+ Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_ts_1.formatMDXSpecifiedByLink; } });
22
+ const output_ts_1 = require("../output.js");
23
+ /** Generic MDX pages use the `.mdx` extension. */
24
+ exports.mdxExtension = ".mdx";
25
+ /**
26
+ * Formats an admonition as a Markdown blockquote with a bold type/title label.
27
+ * @param admonition - Admonition data with text, title, and type
28
+ * @param _meta - Unused metadata parameter
29
+ * @returns Formatted admonition string
30
+ */
31
+ const formatMDXAdmonition = ({ text, title, type }, _meta) => {
32
+ const label = title?.trim() ? title.trim() : type.toUpperCase();
33
+ return `${utils_1.MARKDOWN_EOP}> **${label}**${utils_1.MARKDOWN_EOL}>${utils_1.MARKDOWN_EOL}${(0, helpers_1.quoteMarkdownLines)(text, utils_1.MARKDOWN_EOL)}${utils_1.MARKDOWN_EOP}`;
34
+ };
35
+ exports.formatMDXAdmonition = formatMDXAdmonition;
36
+ /**
37
+ * Formats a collapsible block as an HTML `<details>` element.
38
+ * The output is split on `\r` by the printer into [openSection, closeSection].
39
+ * @param option - Configuration for open/close label text
40
+ * @returns Formatted collapsible string
41
+ */
42
+ const formatMDXDetails = ({ dataOpen, dataClose, }) => {
43
+ return `${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}`;
44
+ };
45
+ exports.formatMDXDetails = formatMDXDetails;
46
+ /**
47
+ * Rewrites extensionless absolute links so they point to `.mdx` pages.
48
+ * @param link - Link data with URL and text
49
+ * @returns The link with `.mdx` appended to extensionless absolute paths
50
+ */
51
+ const formatMDXLink = (link) => {
52
+ const { url } = link;
53
+ if (!url) {
54
+ return link;
55
+ }
56
+ return {
57
+ ...link,
58
+ url: (0, helpers_1.appendExtensionToAbsolutePathWithoutExtension)(url, exports.mdxExtension),
59
+ };
60
+ };
61
+ exports.formatMDXLink = formatMDXLink;
62
+ /**
63
+ * Formats a header permalink with escaped braces (`\{#id\}`), valid in MDX.
64
+ * @param id - The ID of the section header
65
+ * @returns Escaped permalink string
66
+ */
67
+ exports.formatMDXPermalink = defaults_ts_1.formatMDXEscapedPermalink;
68
+ const rewriteInternalLinks = (0, output_ts_1.createInternalLinksRewriter)(exports.mdxExtension);
69
+ /**
70
+ * Rewrites absolute generated doc links to page-relative `.mdx` paths after each page is rendered.
71
+ */
72
+ const afterRenderTypeEntitiesHook = async (event) => {
73
+ await (0, output_ts_1.rewriteRenderedPage)(event, rewriteInternalLinks);
74
+ };
75
+ exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
76
+ /**
77
+ * Creates a generic MDX formatter.
78
+ * @param _meta - Unused metadata parameter
79
+ * @returns A complete {@link Formatter} implementation for generic MDX output
80
+ */
81
+ const createMDXFormatter = (_meta) => {
82
+ return {
83
+ formatMDXBadge: defaults_ts_1.formatMDXBadge,
84
+ formatMDXAdmonition: exports.formatMDXAdmonition,
85
+ formatMDXBullet: defaults_ts_1.formatMDXBullet,
86
+ formatMDXDetails: exports.formatMDXDetails,
87
+ formatMDXFrontmatter: defaults_ts_1.formatMDXFrontmatter,
88
+ formatMDXLink: exports.formatMDXLink,
89
+ formatMDXNameEntity: defaults_ts_1.formatMDXNameEntity,
90
+ formatMDXPermalink: exports.formatMDXPermalink,
91
+ formatMDXSpecifiedByLink: defaults_ts_1.formatMDXSpecifiedByLink,
92
+ };
93
+ };
94
+ exports.createMDXFormatter = createMDXFormatter;
@@ -7,7 +7,7 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, RenderTypeEntitiesHook } from "@graphql-markdown/types";
10
- import { formatMDXBullet, formatMDXLink, formatMDXPermalink } from "../defaults";
10
+ import { formatMDXBullet, formatMDXLink, formatMDXPermalink } from "../defaults.ts";
11
11
  export declare const __default: {
12
12
  formatMDXBullet: typeof formatMDXBullet;
13
13
  formatMDXLink: typeof formatMDXLink;
@@ -61,7 +61,7 @@ export declare const mdxExtension: ".md";
61
61
  * @param event - Hook payload containing the current file path and renderer output context
62
62
  */
63
63
  export declare const afterRenderTypeEntitiesHook: RenderTypeEntitiesHook;
64
- export { formatMDXBullet, formatMDXPermalink } from "../defaults";
64
+ export { formatMDXBullet, formatMDXPermalink } from "../defaults.ts";
65
65
  /**
66
66
  * Creates an MkDocs Material formatter.
67
67
  * @param _meta - Unused metadata parameter
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mkdocs/index.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,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACL,eAAe,EAEf,aAAa,EACb,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,SAAS;;;;CAIrB,CAAC;AAmCF;;;;GAIG;AACH,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SAEhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAEF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SAEtD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBAIzC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mkdocs/index.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,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,eAAe,EAEf,aAAa,EACb,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,SAAS,EAAE;IACtB,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;CAK/C,CAAC;AAeF;;;;GAIG;AACH,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SAEhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAEF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SAEtD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBAIzC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
@@ -11,12 +11,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.createMDXFormatter = exports.formatMDXPermalink = exports.formatMDXBullet = exports.afterRenderTypeEntitiesHook = exports.mdxExtension = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.__default = void 0;
12
12
  const helpers_1 = require("@graphql-markdown/helpers");
13
13
  const utils_1 = require("@graphql-markdown/utils");
14
- const defaults_1 = require("../defaults");
15
- const output_1 = require("../output");
14
+ const defaults_ts_1 = require("../defaults.js");
15
+ const output_ts_1 = require("../output.js");
16
16
  exports.__default = {
17
- formatMDXBullet: defaults_1.formatMDXBullet,
18
- formatMDXLink: defaults_1.formatMDXLink,
19
- formatMDXPermalink: defaults_1.formatMDXPermalink,
17
+ formatMDXBullet: defaults_ts_1.formatMDXBullet,
18
+ formatMDXLink: defaults_ts_1.formatMDXLink,
19
+ formatMDXPermalink: defaults_ts_1.formatMDXPermalink,
20
20
  };
21
21
  const ADMONITION_TYPE_MAP = {
22
22
  note: "note",
@@ -28,18 +28,7 @@ const ADMONITION_TYPE_MAP = {
28
28
  caution: "warning",
29
29
  success: "success",
30
30
  };
31
- const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
32
- return content.replaceAll(/\]\((\/[^)\s#]+)(#[^)\s]+)?\)/g, (_match, urlPath, hash = "") => {
33
- const relativePath = (0, utils_1.toRelativeGeneratedDocLink)({
34
- baseURL,
35
- currentFilePath: filePath,
36
- outputDir,
37
- targetUrlPath: urlPath,
38
- });
39
- const target = relativePath ?? urlPath;
40
- return `](${target}${hash})`;
41
- });
42
- };
31
+ const rewriteInternalLinks = (0, output_ts_1.createInternalLinksRewriter)();
43
32
  /**
44
33
  * Formats a badge as an inline HTML mark element.
45
34
  * @param badge - Badge data containing text and optional classname
@@ -78,7 +67,7 @@ exports.formatMDXDetails = formatMDXDetails;
78
67
  * @returns Visible heading string, or empty string if no title is available
79
68
  */
80
69
  const formatMDXFrontmatter = (_props, formatted) => {
81
- return (0, defaults_1.formatMDXFrontmatterTitleOnly)(formatted);
70
+ return (0, defaults_ts_1.formatMDXFrontmatterTitleOnly)(formatted);
82
71
  };
83
72
  exports.formatMDXFrontmatter = formatMDXFrontmatter;
84
73
  /**
@@ -109,12 +98,12 @@ exports.mdxExtension = ".md";
109
98
  * @param event - Hook payload containing the current file path and renderer output context
110
99
  */
111
100
  const afterRenderTypeEntitiesHook = async (event) => {
112
- await (0, output_1.rewriteRenderedPage)(event, rewriteInternalLinks);
101
+ await (0, output_ts_1.rewriteRenderedPage)(event, rewriteInternalLinks);
113
102
  };
114
103
  exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
115
- var defaults_2 = require("../defaults");
116
- Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
117
- Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_2.formatMDXPermalink; } });
104
+ var defaults_ts_2 = require("../defaults.js");
105
+ Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_ts_2.formatMDXBullet; } });
106
+ Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_ts_2.formatMDXPermalink; } });
118
107
  /**
119
108
  * Creates an MkDocs Material formatter.
120
109
  * @param _meta - Unused metadata parameter
@@ -124,12 +113,12 @@ const createMDXFormatter = (_meta) => {
124
113
  return {
125
114
  formatMDXBadge: exports.formatMDXBadge,
126
115
  formatMDXAdmonition: exports.formatMDXAdmonition,
127
- formatMDXBullet: defaults_1.formatMDXBullet,
116
+ formatMDXBullet: defaults_ts_1.formatMDXBullet,
128
117
  formatMDXDetails: exports.formatMDXDetails,
129
118
  formatMDXFrontmatter: exports.formatMDXFrontmatter,
130
- formatMDXLink: defaults_1.formatMDXLink,
119
+ formatMDXLink: defaults_ts_1.formatMDXLink,
131
120
  formatMDXNameEntity: exports.formatMDXNameEntity,
132
- formatMDXPermalink: defaults_1.formatMDXPermalink,
121
+ formatMDXPermalink: defaults_ts_1.formatMDXPermalink,
133
122
  formatMDXSpecifiedByLink: exports.formatMDXSpecifiedByLink,
134
123
  };
135
124
  };
package/dist/output.d.ts CHANGED
@@ -54,5 +54,12 @@ export declare const writeOutput: (filePath: string, content: string, outputAdap
54
54
  * @param event - The hook event, carrying the page path and its destination
55
55
  * @param rewrite - Returns the new content, or the content unchanged to skip
56
56
  */
57
- export declare const rewriteRenderedPage: (event: unknown, rewrite: (content: string, filePath: string, outputDir: string, baseURL: string) => string) => Promise<void>;
57
+ export declare const rewriteRenderedPage: (event: unknown, rewrite: (content: string, filePath: string, outputDir: string, baseURL: string, linkRoot?: string, knownDocPaths?: ReadonlySet<string>) => string) => Promise<void>;
58
+ /**
59
+ * Creates a rewriter turning absolute generated doc links into page-relative ones.
60
+ *
61
+ * @param extension - Page extension to resolve targets with (defaults to `.md`)
62
+ * @returns A rewrite function usable with {@link rewriteRenderedPage}
63
+ */
64
+ export declare const createInternalLinksRewriter: (extension?: string) => ((content: string, filePath: string, outputDir: string, baseURL: string, linkRoot?: string, knownDocPaths?: ReadonlySet<string>) => string);
58
65
  //# sourceMappingURL=output.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA0BpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,aACX,MAAM,iBACD,KAAK,CAAC,aAAa,CAAC,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,iBACD,KAAK,CAAC,aAAa,CAAC,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAE5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,aACZ,MAAM,WACP,MAAM,iBACA,KAAK,CAAC,aAAa,CAAC,YACzB,MAAM,KACf,OAAO,CAAC,IAAI,CAQd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,UACvB,OAAO,WACL,CACP,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,KACZ,MAAM,KACV,OAAO,CAAC,IAAI,CAuBd,CAAC"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA6BpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,aACX,MAAM,iBACD,KAAK,CAAC,aAAa,CAAC,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,iBACD,KAAK,CAAC,aAAa,CAAC,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAE5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,aACZ,MAAM,WACP,MAAM,iBACA,KAAK,CAAC,aAAa,CAAC,YACzB,MAAM,KACf,OAAO,CAAC,IAAI,CAQd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,UACvB,OAAO,WACL,CACP,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,KAChC,MAAM,KACV,OAAO,CAAC,IAAI,CAuCd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,eAC1B,MAAM,KACjB,CAAC,CACF,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,KAChC,MAAM,CAoBV,CAAC"}
package/dist/output.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.rewriteRenderedPage = exports.writeOutput = exports.readOptionalOutput = exports.readOutput = void 0;
13
+ exports.createInternalLinksRewriter = exports.rewriteRenderedPage = exports.writeOutput = exports.readOptionalOutput = exports.readOutput = void 0;
14
14
  const utils_1 = require("@graphql-markdown/utils");
15
15
  /**
16
16
  * Resolves the destination a hook must use, falling back to the filesystem.
@@ -99,14 +99,38 @@ exports.writeOutput = writeOutput;
99
99
  * @param rewrite - Returns the new content, or the content unchanged to skip
100
100
  */
101
101
  const rewriteRenderedPage = async (event, rewrite) => {
102
- const { baseURL, filePath, outputAdapter, outputDir } = event.data;
102
+ const { baseURL, filePath, knownDocPaths, linkRoot, outputAdapter, outputDir, } = event.data;
103
103
  const content = await (0, exports.readOutput)(filePath, outputAdapter);
104
104
  if (typeof content !== "string") {
105
105
  return;
106
106
  }
107
- const rewritten = rewrite(content, filePath, outputDir, baseURL);
107
+ const rewritten = rewrite(content, filePath, outputDir, baseURL, linkRoot, knownDocPaths);
108
108
  if (rewritten !== content) {
109
109
  await (0, exports.writeOutput)(filePath, rewritten, outputAdapter);
110
110
  }
111
111
  };
112
112
  exports.rewriteRenderedPage = rewriteRenderedPage;
113
+ /**
114
+ * Creates a rewriter turning absolute generated doc links into page-relative ones.
115
+ *
116
+ * @param extension - Page extension to resolve targets with (defaults to `.md`)
117
+ * @returns A rewrite function usable with {@link rewriteRenderedPage}
118
+ */
119
+ const createInternalLinksRewriter = (extension) => {
120
+ return (content, filePath, outputDir, baseURL, linkRoot, knownDocPaths) => {
121
+ return content.replaceAll(/\]\((\/[^)\s#]+)(#[^)\s]+)?\)/g, (_match, urlPath, hash = "") => {
122
+ const relativePath = (0, utils_1.toRelativeGeneratedDocLink)({
123
+ baseURL,
124
+ currentFilePath: filePath,
125
+ ...(extension !== undefined && { extension }),
126
+ ...(linkRoot !== undefined && { linkRoot }),
127
+ knownDocPaths,
128
+ outputDir,
129
+ targetUrlPath: urlPath,
130
+ });
131
+ const target = relativePath ?? urlPath;
132
+ return `](${target}${hash})`;
133
+ });
134
+ };
135
+ };
136
+ exports.createInternalLinksRewriter = createInternalLinksRewriter;
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  import type { AdmonitionType, Badge, Formatter, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
11
- import { formatMDXEscapedPermalink } from "../defaults";
11
+ import { formatMDXEscapedPermalink } from "../defaults.ts";
12
12
  /**
13
13
  * Formats a permalink for a section header, using the classic `{#id}` syntax
14
14
  * escaped to remain valid MDX.
@@ -47,7 +47,7 @@ export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType
47
47
  * @returns Unmodified link
48
48
  */
49
49
  export declare const formatMDXLink: (link: TypeLink) => TypeLink;
50
- export { formatMDXBullet, formatMDXDetails, formatMDXFrontmatter, formatMDXNameEntity, formatMDXSpecifiedByLink, } from "../defaults";
50
+ export { formatMDXBullet, formatMDXDetails, formatMDXFrontmatter, formatMDXNameEntity, formatMDXSpecifiedByLink, } from "../defaults.ts";
51
51
  /**
52
52
  * Creates an Astro Starlight formatter.
53
53
  * @param _meta - Unused metadata parameter
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starlight/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAIL,yBAAyB,EAG1B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,kCAA4B,CAAC;AAE5D,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,MAAe,CAAC;AAE5C,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,SAEf,CAAC;AAEf;;;;;GAKG;AACH,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAG3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAE9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starlight/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAIL,yBAAyB,EAG1B,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,yBACb,CAAC;AAE5B,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,MAAe,CAAC;AAE5C,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,SAEf,CAAC;AAEf;;;;;GAKG;AACH,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAG3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAE9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
@@ -11,7 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXLink = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxDeclaration = exports.mdxExtension = exports.formatMDXPermalink = void 0;
13
13
  const utils_1 = require("@graphql-markdown/utils");
14
- const defaults_1 = require("../defaults");
14
+ const defaults_ts_1 = require("../defaults.js");
15
15
  /**
16
16
  * Formats a permalink for a section header, using the classic `{#id}` syntax
17
17
  * escaped to remain valid MDX.
@@ -23,7 +23,7 @@ const defaults_1 = require("../defaults");
23
23
  * @param id - The ID of the section header
24
24
  * @returns Formatted permalink string
25
25
  */
26
- exports.formatMDXPermalink = defaults_1.formatMDXEscapedPermalink;
26
+ exports.formatMDXPermalink = defaults_ts_1.formatMDXEscapedPermalink;
27
27
  /** File extension used for generated pages. */
28
28
  exports.mdxExtension = ".mdx";
29
29
  /** MDX import statement prepended to every generated file to register Starlight components. */
@@ -63,12 +63,12 @@ const formatMDXLink = (link) => {
63
63
  return link;
64
64
  };
65
65
  exports.formatMDXLink = formatMDXLink;
66
- var defaults_2 = require("../defaults");
67
- Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
68
- Object.defineProperty(exports, "formatMDXDetails", { enumerable: true, get: function () { return defaults_2.formatMDXDetails; } });
69
- Object.defineProperty(exports, "formatMDXFrontmatter", { enumerable: true, get: function () { return defaults_2.formatMDXFrontmatter; } });
70
- Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_2.formatMDXNameEntity; } });
71
- Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
66
+ var defaults_ts_2 = require("../defaults.js");
67
+ Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_ts_2.formatMDXBullet; } });
68
+ Object.defineProperty(exports, "formatMDXDetails", { enumerable: true, get: function () { return defaults_ts_2.formatMDXDetails; } });
69
+ Object.defineProperty(exports, "formatMDXFrontmatter", { enumerable: true, get: function () { return defaults_ts_2.formatMDXFrontmatter; } });
70
+ Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_ts_2.formatMDXNameEntity; } });
71
+ Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_ts_2.formatMDXSpecifiedByLink; } });
72
72
  /**
73
73
  * Creates an Astro Starlight formatter.
74
74
  * @param _meta - Unused metadata parameter
@@ -78,13 +78,13 @@ const createMDXFormatter = (_meta) => {
78
78
  return {
79
79
  formatMDXBadge: exports.formatMDXBadge,
80
80
  formatMDXAdmonition: exports.formatMDXAdmonition,
81
- formatMDXBullet: defaults_1.formatMDXBullet,
82
- formatMDXDetails: defaults_1.formatMDXDetails,
83
- formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
81
+ formatMDXBullet: defaults_ts_1.formatMDXBullet,
82
+ formatMDXDetails: defaults_ts_1.formatMDXDetails,
83
+ formatMDXFrontmatter: defaults_ts_1.formatMDXFrontmatter,
84
84
  formatMDXLink: exports.formatMDXLink,
85
- formatMDXNameEntity: defaults_1.formatMDXNameEntity,
85
+ formatMDXNameEntity: defaults_ts_1.formatMDXNameEntity,
86
86
  formatMDXPermalink: exports.formatMDXPermalink,
87
- formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
87
+ formatMDXSpecifiedByLink: defaults_ts_1.formatMDXSpecifiedByLink,
88
88
  };
89
89
  };
90
90
  exports.createMDXFormatter = createMDXFormatter;
@@ -6,7 +6,7 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  import type { AdmonitionType, Badge, Formatter, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
9
- import { formatMDXEscapedPermalink } from "../defaults";
9
+ import { formatMDXEscapedPermalink } from "../defaults.ts";
10
10
  /**
11
11
  * Formats a permalink for a section header, using the classic `{#id}` syntax
12
12
  * escaped to remain valid MDX.
@@ -59,7 +59,7 @@ export declare const formatMDXLink: ({ text, url }: TypeLink) => TypeLink;
59
59
  * @returns Formatted JSX entity reference string
60
60
  */
61
61
  export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
62
- export { formatMDXDetails, formatMDXFrontmatter, formatMDXSpecifiedByLink, } from "../defaults";
62
+ export { formatMDXDetails, formatMDXFrontmatter, formatMDXSpecifiedByLink, } from "../defaults.ts";
63
63
  /**
64
64
  * Creates a Vocs formatter.
65
65
  * @param _meta - Unused metadata parameter
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vocs/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAEL,yBAAyB,EAG1B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,kCAA4B,CAAC;AAE5D,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,SAEf,CAAC;AAEf,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,MAAe,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAG3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,qBAAgB,SAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,kBAAmB,QAAQ,KAAG,QAKvD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAKF,CAAC;AAEF,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vocs/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAEL,yBAAyB,EAG1B,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,yBACb,CAAC;AAE5B,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,SAEf,CAAC;AAEf,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,MAAe,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAG3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,qBAAgB,SAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,kBAAmB,QAAQ,KAAG,QAKvD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAKF,CAAC;AAEF,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXNameEntity = exports.formatMDXLink = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxExtension = exports.mdxDeclaration = exports.formatMDXPermalink = void 0;
11
11
  const helpers_1 = require("@graphql-markdown/helpers");
12
12
  const utils_1 = require("@graphql-markdown/utils");
13
- const defaults_1 = require("../defaults");
13
+ const defaults_ts_1 = require("../defaults.js");
14
14
  /**
15
15
  * Formats a permalink for a section header, using the classic `{#id}` syntax
16
16
  * escaped to remain valid MDX.
@@ -24,7 +24,7 @@ const defaults_1 = require("../defaults");
24
24
  * @param id - The ID of the section header
25
25
  * @returns Formatted permalink string
26
26
  */
27
- exports.formatMDXPermalink = defaults_1.formatMDXEscapedPermalink;
27
+ exports.formatMDXPermalink = defaults_ts_1.formatMDXEscapedPermalink;
28
28
  /** MDX import statement and inline component definitions prepended to every generated file. */
29
29
  exports.mdxDeclaration = `
30
30
  export const Bullet = () => <><span style={{ fontWeight: 'normal', fontSize: '.5em' }}>&nbsp;●&nbsp;</span></>
@@ -88,10 +88,10 @@ const formatMDXNameEntity = (name, parentType) => {
88
88
  return `<span className="gqlmd-mdx-entity"><code className="gqlmd-mdx-entity-name">${name}</code></span>`;
89
89
  };
90
90
  exports.formatMDXNameEntity = formatMDXNameEntity;
91
- var defaults_2 = require("../defaults");
92
- Object.defineProperty(exports, "formatMDXDetails", { enumerable: true, get: function () { return defaults_2.formatMDXDetails; } });
93
- Object.defineProperty(exports, "formatMDXFrontmatter", { enumerable: true, get: function () { return defaults_2.formatMDXFrontmatter; } });
94
- Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
91
+ var defaults_ts_2 = require("../defaults.js");
92
+ Object.defineProperty(exports, "formatMDXDetails", { enumerable: true, get: function () { return defaults_ts_2.formatMDXDetails; } });
93
+ Object.defineProperty(exports, "formatMDXFrontmatter", { enumerable: true, get: function () { return defaults_ts_2.formatMDXFrontmatter; } });
94
+ Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_ts_2.formatMDXSpecifiedByLink; } });
95
95
  /**
96
96
  * Creates a Vocs formatter.
97
97
  * @param _meta - Unused metadata parameter
@@ -102,12 +102,12 @@ const createMDXFormatter = (_meta) => {
102
102
  formatMDXBadge: exports.formatMDXBadge,
103
103
  formatMDXAdmonition: exports.formatMDXAdmonition,
104
104
  formatMDXBullet: exports.formatMDXBullet,
105
- formatMDXDetails: defaults_1.formatMDXDetails,
106
- formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
105
+ formatMDXDetails: defaults_ts_1.formatMDXDetails,
106
+ formatMDXFrontmatter: defaults_ts_1.formatMDXFrontmatter,
107
107
  formatMDXLink: exports.formatMDXLink,
108
108
  formatMDXNameEntity: exports.formatMDXNameEntity,
109
109
  formatMDXPermalink: exports.formatMDXPermalink,
110
- formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
110
+ formatMDXSpecifiedByLink: defaults_ts_1.formatMDXSpecifiedByLink,
111
111
  };
112
112
  };
113
113
  exports.createMDXFormatter = createMDXFormatter;