@graphql-markdown/formatters 1.0.0 → 1.0.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.
- package/dist/docfx/index.d.ts.map +1 -1
- package/dist/docfx/index.js +58 -2
- package/dist/honkit/index.d.ts +2 -1
- package/dist/honkit/index.d.ts.map +1 -1
- package/dist/mdbook/index.d.ts +12 -1
- package/dist/mdbook/index.d.ts.map +1 -1
- package/dist/mdbook/index.js +34 -2
- package/dist/mkdocs/index.d.ts +3 -2
- package/dist/mkdocs/index.d.ts.map +1 -1
- package/dist/starlight/index.d.ts +4 -3
- package/dist/starlight/index.d.ts.map +1 -1
- package/dist/starlight/index.js +5 -8
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docfx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACT,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docfx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AA+BjC,sFAAsF;AACtF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIlD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAI3D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,UACxB,KAAK,CAAC,kBAAkB,CAAC,aACrB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAgBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAE9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAW5D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAgI3C;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBA4DzC,CAAC"}
|
package/dist/docfx/index.js
CHANGED
|
@@ -110,6 +110,61 @@ const createMDXFormatter = (_meta) => {
|
|
|
110
110
|
};
|
|
111
111
|
exports.createMDXFormatter = createMDXFormatter;
|
|
112
112
|
exports.mdxExtension = ".md";
|
|
113
|
+
const isAbsoluteInternalLink = (content, urlStart) => {
|
|
114
|
+
if (content[urlStart] !== "/")
|
|
115
|
+
return null;
|
|
116
|
+
const closePos = content.indexOf(")", urlStart);
|
|
117
|
+
if (closePos === -1)
|
|
118
|
+
return null;
|
|
119
|
+
const urlWithHash = content.slice(urlStart, closePos);
|
|
120
|
+
if (/\s/u.test(urlWithHash))
|
|
121
|
+
return null;
|
|
122
|
+
return { closePos, urlWithHash };
|
|
123
|
+
};
|
|
124
|
+
const resolveLink = (urlWithHash, filePath, outputDir, normalizedBaseURL, baseSegment) => {
|
|
125
|
+
const sepIdx = urlWithHash.indexOf("#");
|
|
126
|
+
const [urlPath, hash] = sepIdx < 0
|
|
127
|
+
? [urlWithHash, ""]
|
|
128
|
+
: [urlWithHash.slice(0, sepIdx), urlWithHash.slice(sepIdx)];
|
|
129
|
+
// Strip any linkRoot prefix so toRelativeGeneratedDocLink can resolve the path.
|
|
130
|
+
// e.g. /docs/graphql/types/scalars/id → /graphql/types/scalars/id
|
|
131
|
+
const baseIndex = urlPath.indexOf(baseSegment);
|
|
132
|
+
if (baseIndex === -1)
|
|
133
|
+
return `](${urlWithHash})`;
|
|
134
|
+
const relative = (0, utils_1.toRelativeGeneratedDocLink)({
|
|
135
|
+
baseURL: normalizedBaseURL,
|
|
136
|
+
currentFilePath: filePath,
|
|
137
|
+
extension: exports.mdxExtension,
|
|
138
|
+
outputDir,
|
|
139
|
+
targetUrlPath: urlPath.slice(baseIndex),
|
|
140
|
+
});
|
|
141
|
+
return `](${relative ?? urlPath}${hash})`;
|
|
142
|
+
};
|
|
143
|
+
const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
|
|
144
|
+
const normalizedBaseURL = baseURL.split("/").filter(Boolean).join("/");
|
|
145
|
+
const baseSegment = `/${normalizedBaseURL}/`;
|
|
146
|
+
// Use indexOf scanning instead of regex to avoid ReDoS on file content.
|
|
147
|
+
const out = [];
|
|
148
|
+
let pos = 0;
|
|
149
|
+
while (pos < content.length) {
|
|
150
|
+
const markerPos = content.indexOf("](", pos);
|
|
151
|
+
if (markerPos === -1) {
|
|
152
|
+
out.push(content.slice(pos));
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
const urlStart = markerPos + 2;
|
|
156
|
+
const match = isAbsoluteInternalLink(content, urlStart);
|
|
157
|
+
if (!match) {
|
|
158
|
+
out.push(content.slice(pos, urlStart));
|
|
159
|
+
pos = urlStart;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
out.push(content.slice(pos, markerPos));
|
|
163
|
+
out.push(resolveLink(match.urlWithHash, filePath, outputDir, normalizedBaseURL, baseSegment));
|
|
164
|
+
pos = match.closePos + 1;
|
|
165
|
+
}
|
|
166
|
+
return out.join("");
|
|
167
|
+
};
|
|
113
168
|
// ─── toc.yml builder ────────────────────────────────────────────────────────
|
|
114
169
|
const writeQueue = new Map();
|
|
115
170
|
const queueFileUpdate = async (filePath, update) => {
|
|
@@ -143,7 +198,7 @@ const seenDirectories = new Set();
|
|
|
143
198
|
* are prepended as an "Overview" entry on first encounter.
|
|
144
199
|
*/
|
|
145
200
|
const afterRenderTypeEntitiesHook = async (event) => {
|
|
146
|
-
const { filePath, name, outputDir } = event.data;
|
|
201
|
+
const { baseURL, filePath, name, outputDir } = event.data;
|
|
147
202
|
const graphqlRoot = (0, node_path_1.resolve)(outputDir);
|
|
148
203
|
// Rewrite uid as a path-derived value to guarantee uniqueness across the site.
|
|
149
204
|
// e.g. operations/queries/continent.md → uid: operations-queries-continent
|
|
@@ -151,7 +206,8 @@ const afterRenderTypeEntitiesHook = async (event) => {
|
|
|
151
206
|
.replace(/\.mdx?$/, "")
|
|
152
207
|
.replaceAll(/[/\\]/g, "-");
|
|
153
208
|
const content = await (0, utils_1.readFile)(filePath, "utf-8");
|
|
154
|
-
const
|
|
209
|
+
const withUid = content.replace(/^(\s*)uid:.*$/m, `$1uid: ${uid}`);
|
|
210
|
+
const rewritten = rewriteInternalLinks(withUid, filePath, outputDir, baseURL);
|
|
155
211
|
if (rewritten !== content) {
|
|
156
212
|
await (0, utils_1.saveFile)(filePath, rewritten);
|
|
157
213
|
}
|
package/dist/honkit/index.d.ts
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
9
|
import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
|
|
10
|
+
import { formatMDXBullet } from "../defaults";
|
|
10
11
|
export declare const __default: {
|
|
11
|
-
formatMDXBullet:
|
|
12
|
+
formatMDXBullet: typeof formatMDXBullet;
|
|
12
13
|
};
|
|
13
14
|
/** File extension used for generated pages — HonKit renders plain Markdown to HTML. */
|
|
14
15
|
export declare const mdxExtension: ".md";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/honkit/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,QAAQ,EACT,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/honkit/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,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,SAAS;;CAAsB,CAAC;AAE7C,uFAAuF;AACvF,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAS3C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SAKhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,UACxB,KAAK,CAAC,kBAAkB,CAAC,aACrB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAiBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,kBAAmB,QAAQ,KAAG,QAoBvD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAEF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SAEtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAW5D,CAAC"}
|
package/dist/mdbook/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
|
-
import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, RenderFilesHook, TypeLink } from "@graphql-markdown/types";
|
|
11
|
+
import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, RenderFilesHook, RenderTypeEntitiesHook, TypeLink } from "@graphql-markdown/types";
|
|
12
12
|
/**
|
|
13
13
|
* Formats a badge as Markdown bold text — mdBook has no badge component.
|
|
14
14
|
* @param badge - Badge data containing text
|
|
@@ -52,6 +52,17 @@ export declare const mdxExtension = ".md";
|
|
|
52
52
|
*/
|
|
53
53
|
export declare const formatMDXLink: (link: TypeLink) => TypeLink;
|
|
54
54
|
export { formatMDXBullet, formatMDXNameEntity, formatMDXSpecifiedByLink, } from "../defaults";
|
|
55
|
+
/**
|
|
56
|
+
* Rewrites absolute generated doc links to page-relative `.md` paths after each page is rendered.
|
|
57
|
+
*
|
|
58
|
+
* mdBook resolves links relative to the book source root, so absolute paths
|
|
59
|
+
* like `/graphql/types/scalars/id.md` are rendered as `/graphql/types/scalars/id.html`
|
|
60
|
+
* in the output HTML — which breaks when the book is served under a subdirectory
|
|
61
|
+
* (e.g. `https://example.com/demo-mdbook/`).
|
|
62
|
+
* Converting them to relative paths (e.g. `../../scalars/id.md`) makes links
|
|
63
|
+
* work correctly regardless of where the book is hosted.
|
|
64
|
+
*/
|
|
65
|
+
export declare const afterRenderTypeEntitiesHook: RenderTypeEntitiesHook;
|
|
55
66
|
/**
|
|
56
67
|
* Creates an mdBook formatter.
|
|
57
68
|
* @param _meta - Unused metadata parameter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdbook/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EACT,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdbook/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAoBjC;;;;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;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,kBAE1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAGF,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAU9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBAoBzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAW5D,CAAC;AAeF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAiFlC,CAAC"}
|
package/dist/mdbook/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.afterRenderFilesHook = exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXBullet = exports.formatMDXLink = exports.mdxExtension = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
|
|
13
|
+
exports.afterRenderFilesHook = exports.createMDXFormatter = exports.afterRenderTypeEntitiesHook = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXBullet = exports.formatMDXLink = exports.mdxExtension = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
|
|
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");
|
|
@@ -86,6 +86,38 @@ var defaults_2 = require("../defaults");
|
|
|
86
86
|
Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
|
|
87
87
|
Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_2.formatMDXNameEntity; } });
|
|
88
88
|
Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
|
|
89
|
+
const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
|
|
90
|
+
return content.replaceAll(/\]\((\/[^)\s#]+)(#[^)\s]+)?\)/g, (_match, urlPath, hash = "") => {
|
|
91
|
+
const relativePath = (0, utils_1.toRelativeGeneratedDocLink)({
|
|
92
|
+
baseURL,
|
|
93
|
+
currentFilePath: filePath,
|
|
94
|
+
extension: exports.mdxExtension,
|
|
95
|
+
outputDir,
|
|
96
|
+
targetUrlPath: urlPath,
|
|
97
|
+
});
|
|
98
|
+
const target = relativePath ?? urlPath;
|
|
99
|
+
return `](${target}${hash})`;
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Rewrites absolute generated doc links to page-relative `.md` paths after each page is rendered.
|
|
104
|
+
*
|
|
105
|
+
* mdBook resolves links relative to the book source root, so absolute paths
|
|
106
|
+
* like `/graphql/types/scalars/id.md` are rendered as `/graphql/types/scalars/id.html`
|
|
107
|
+
* in the output HTML — which breaks when the book is served under a subdirectory
|
|
108
|
+
* (e.g. `https://example.com/demo-mdbook/`).
|
|
109
|
+
* Converting them to relative paths (e.g. `../../scalars/id.md`) makes links
|
|
110
|
+
* work correctly regardless of where the book is hosted.
|
|
111
|
+
*/
|
|
112
|
+
const afterRenderTypeEntitiesHook = async (event) => {
|
|
113
|
+
const { baseURL, filePath, outputDir } = event.data;
|
|
114
|
+
const content = await (0, utils_1.readFile)(filePath, "utf-8");
|
|
115
|
+
const rewrittenContent = rewriteInternalLinks(content, filePath, outputDir, baseURL);
|
|
116
|
+
if (rewrittenContent !== content) {
|
|
117
|
+
await (0, utils_1.saveFile)(filePath, rewrittenContent);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
|
|
89
121
|
/**
|
|
90
122
|
* Creates an mdBook formatter.
|
|
91
123
|
* @param _meta - Unused metadata parameter
|
|
@@ -155,7 +187,7 @@ const afterRenderFilesHook = async (event) => {
|
|
|
155
187
|
"",
|
|
156
188
|
"---",
|
|
157
189
|
"",
|
|
158
|
-
`[GraphQL API Reference](${baseURL}/index${exports.mdxExtension}
|
|
190
|
+
`[GraphQL API Reference](${baseURL}/index${exports.mdxExtension})`,
|
|
159
191
|
"",
|
|
160
192
|
];
|
|
161
193
|
let lastTopSection = null;
|
package/dist/mkdocs/index.d.ts
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
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 } from "../defaults";
|
|
10
11
|
export declare const __default: {
|
|
11
|
-
formatMDXBullet:
|
|
12
|
-
formatMDXLink:
|
|
12
|
+
formatMDXBullet: typeof formatMDXBullet;
|
|
13
|
+
formatMDXLink: typeof formatMDXLink;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Formats a badge as an inline HTML mark element.
|
|
@@ -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;
|
|
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;AAYjC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,SAAS;;;CAGrB,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,SAGF,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,sBAoBzC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAW5D,CAAC"}
|
|
@@ -28,11 +28,12 @@ export declare const formatMDXBadge: ({ text, classname }: Badge) => MDXString;
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType, _meta: Maybe<MetaInfo>) => MDXString;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Returns the link unchanged — Starlight routes `page.mdx` to `page/` so
|
|
32
|
+
* links must not include the `.mdx` extension.
|
|
32
33
|
* @param link - Link data with URL and text
|
|
33
|
-
* @returns
|
|
34
|
+
* @returns Unmodified link
|
|
34
35
|
*/
|
|
35
|
-
export declare const formatMDXLink: (
|
|
36
|
+
export declare const formatMDXLink: (link: TypeLink) => TypeLink;
|
|
36
37
|
export { formatMDXBullet, formatMDXDetails, formatMDXFrontmatter, formatMDXNameEntity, formatMDXSpecifiedByLink, } from "../defaults";
|
|
37
38
|
/**
|
|
38
39
|
* Lifecycle hook that creates an `index.md` file for a category directory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starlight/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starlight/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAgBjC,+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;AAIrB;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,UAAiB;IAC3D,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C,KAAG,OAAO,CAAC,IAAI,CAWf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,UAAiB;IACvD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C,KAAG,OAAO,CAAC,IAAI,CAQf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAW5D,CAAC"}
|
package/dist/starlight/index.js
CHANGED
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createMDXFormatter = exports.afterRenderTypeEntitiesHook = exports.beforeGenerateIndexMetafileHook = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXLink = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxDeclaration = exports.mdxExtension = void 0;
|
|
13
13
|
const node_path_1 = require("node:path");
|
|
14
14
|
const promises_1 = require("node:fs/promises");
|
|
15
|
-
const helpers_1 = require("@graphql-markdown/helpers");
|
|
16
15
|
const utils_1 = require("@graphql-markdown/utils");
|
|
17
16
|
const defaults_1 = require("../defaults");
|
|
18
17
|
/** File extension used for generated pages. */
|
|
@@ -45,15 +44,13 @@ const formatMDXAdmonition = ({ text, title, type }, _meta) => {
|
|
|
45
44
|
};
|
|
46
45
|
exports.formatMDXAdmonition = formatMDXAdmonition;
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
47
|
+
* Returns the link unchanged — Starlight routes `page.mdx` to `page/` so
|
|
48
|
+
* links must not include the `.mdx` extension.
|
|
49
49
|
* @param link - Link data with URL and text
|
|
50
|
-
* @returns
|
|
50
|
+
* @returns Unmodified link
|
|
51
51
|
*/
|
|
52
|
-
const formatMDXLink = (
|
|
53
|
-
return
|
|
54
|
-
text,
|
|
55
|
-
url: (0, helpers_1.appendLinkExtension)(url, exports.mdxExtension),
|
|
56
|
-
};
|
|
52
|
+
const formatMDXLink = (link) => {
|
|
53
|
+
return link;
|
|
57
54
|
};
|
|
58
55
|
exports.formatMDXLink = formatMDXLink;
|
|
59
56
|
var defaults_2 = require("../defaults");
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/graphql-markdown/graphql-markdown/issues"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -206,18 +206,18 @@
|
|
|
206
206
|
"test:watch": "jest --watch"
|
|
207
207
|
},
|
|
208
208
|
"dependencies": {
|
|
209
|
-
"@graphql-markdown/helpers": "
|
|
210
|
-
"@graphql-markdown/types": "
|
|
211
|
-
"@graphql-markdown/utils": "
|
|
209
|
+
"@graphql-markdown/helpers": "",
|
|
210
|
+
"@graphql-markdown/types": "",
|
|
211
|
+
"@graphql-markdown/utils": ""
|
|
212
212
|
},
|
|
213
213
|
"devDependencies": {
|
|
214
|
-
"@graphql-markdown/tooling-config": "
|
|
214
|
+
"@graphql-markdown/tooling-config": ""
|
|
215
215
|
},
|
|
216
216
|
"directories": {
|
|
217
217
|
"test": "tests"
|
|
218
218
|
},
|
|
219
219
|
"engines": {
|
|
220
|
-
"node": ">=
|
|
220
|
+
"node": ">=22.12.0"
|
|
221
221
|
},
|
|
222
222
|
"publishConfig": {
|
|
223
223
|
"access": "public"
|