File tree 8 files changed +61
-4
lines changed
packages/docusaurus-plugin-openapi-docs/src
8 files changed +61
-4
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,10 @@ const config: Config = {
297
297
groupPathsBy : "tag" ,
298
298
categoryLinkSource : "tag" ,
299
299
} ,
300
- template : "api.mustache" , // Customize API MDX with mustache template
300
+ template : "templates/api.mustache" , // Customize API MDX with mustache template
301
+ infoTemplate : "templates/info.mustache" ,
302
+ tagTemplate : "templates/tag.mustache" ,
303
+ schemaTemplate : "templates/schema.mustache" ,
301
304
downloadUrl : "/petstore.yaml" ,
302
305
hideSendButton : false ,
303
306
showSchemas : true ,
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ ---
2
+ id: { {{id} }}
3
+ title: "{ {{title} }}"
4
+ description: "{ {{frontMatter.description} }}"
5
+ sidebar_label: "{ {{title} }}"
6
+ hide_title: true
7
+ custom_edit_url: null
8
+ ---
9
+
10
+ { {{markdown} }}
11
+
12
+ Hello World!
Original file line number Diff line number Diff line change
1
+ ---
2
+ id: { {{id} }}
3
+ title: "{ {{title} }}"
4
+ description: "{ {{frontMatter.description} }}"
5
+ sidebar_label: "{ {{title} }}"
6
+ hide_title: true
7
+ { {#schema} }
8
+ hide_table_of_contents: true
9
+ { {/schema} }
10
+ schema: true
11
+ sample: { {{frontMatter.sample} }}
12
+ custom_edit_url: null
13
+ ---
14
+
15
+ { {{markdown} }}
16
+
17
+ Hello World!
Original file line number Diff line number Diff line change
1
+ ---
2
+ id: { {{id} }}
3
+ title: "{ {{frontMatter.description} }}"
4
+ description: "{ {{frontMatter.description} }}"
5
+ custom_edit_url: null
6
+ ---
7
+
8
+ { {{markdown} }}
9
+
10
+ Hello World!
Original file line number Diff line number Diff line change @@ -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}}}"
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ export const OptionsSchema = Joi.object({
39
39
proxy : Joi . string ( ) ,
40
40
outputDir : Joi . string ( ) . required ( ) ,
41
41
template : Joi . string ( ) ,
42
+ infoTemplate : Joi . string ( ) ,
43
+ tagTemplate : Joi . string ( ) ,
44
+ schemaTemplate : Joi . string ( ) ,
42
45
downloadUrl : Joi . string ( ) ,
43
46
hideSendButton : Joi . boolean ( ) ,
44
47
showExtensions : Joi . boolean ( ) ,
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ export interface APIOptions {
35
35
specPath : string ;
36
36
outputDir : string ;
37
37
template ?: string ;
38
+ infoTemplate ?: string ;
39
+ tagTemplate ?: string ;
40
+ schemaTemplate ?: string ;
38
41
downloadUrl ?: string ;
39
42
hideSendButton ?: boolean ;
40
43
showExtensions ?: boolean ;
You can’t perform that action at this time.
0 commit comments