@@ -117,6 +117,9 @@ export default function pluginOpenAPIDocs(
117
117
specPath,
118
118
outputDir,
119
119
template,
120
+ infoTemplate,
121
+ tagTemplate,
122
+ schemaTemplate,
120
123
markdownGenerators,
121
124
downloadUrl,
122
125
sidebarOptions,
@@ -236,7 +239,9 @@ show_extensions: true
236
239
{{{markdown}}}
237
240
` ;
238
241
239
- const infoMdTemplate = `---
242
+ const infoMdTemplate = infoTemplate
243
+ ? fs . readFileSync ( infoTemplate ) . toString ( )
244
+ : `---
240
245
id: {{{id}}}
241
246
title: "{{{title}}}"
242
247
description: "{{{frontMatter.description}}}"
@@ -255,7 +260,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
255
260
\`\`\`
256
261
` ;
257
262
258
- const tagMdTemplate = `---
263
+ const tagMdTemplate = tagTemplate
264
+ ? fs . readFileSync ( tagTemplate ) . toString ( )
265
+ : `---
259
266
id: {{{id}}}
260
267
title: "{{{frontMatter.description}}}"
261
268
description: "{{{frontMatter.description}}}"
@@ -272,7 +279,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
272
279
\`\`\`
273
280
` ;
274
281
275
- const schemaMdTemplate = `---
282
+ const schemaMdTemplate = schemaTemplate
283
+ ? fs . readFileSync ( schemaTemplate ) . toString ( )
284
+ : `---
276
285
id: {{{id}}}
277
286
title: "{{{title}}}"
278
287
description: "{{{frontMatter.description}}}"
@@ -371,21 +380,14 @@ custom_edit_url: null
371
380
}
372
381
}
373
382
374
- // TODO: determine if we actually want/need this
375
383
if ( item . type === "info" ) {
376
384
if ( ! fs . existsSync ( `${ outputDir } /${ item . id } .info.mdx` ) ) {
377
385
try {
378
- sidebarOptions ?. categoryLinkSource === "info" // Only use utils template if set to "info"
379
- ? fs . writeFileSync (
380
- `${ outputDir } /${ item . id } .info.mdx` ,
381
- utils ,
382
- "utf8"
383
- )
384
- : fs . writeFileSync (
385
- `${ outputDir } /${ item . id } .info.mdx` ,
386
- view ,
387
- "utf8"
388
- ) ;
386
+ fs . writeFileSync (
387
+ `${ outputDir } /${ item . id } .info.mdx` ,
388
+ utils ,
389
+ "utf8"
390
+ ) ;
389
391
console . log (
390
392
chalk . green (
391
393
`Successfully created "${ outputDir } /${ item . id } .info.mdx"`
0 commit comments