File tree Expand file tree Collapse file tree 8 files changed +61
-4
lines changed
packages/docusaurus-plugin-openapi-docs/src Expand file tree Collapse file tree 8 files changed +61
-4
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,10 @@ const config: Config = {
297297 groupPathsBy : "tag" ,
298298 categoryLinkSource : "tag" ,
299299 } ,
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" ,
301304 downloadUrl : "/petstore.yaml" ,
302305 hideSendButton : false ,
303306 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(
117117 specPath,
118118 outputDir,
119119 template,
120+ infoTemplate,
121+ tagTemplate,
122+ schemaTemplate,
120123 markdownGenerators,
121124 downloadUrl,
122125 sidebarOptions,
@@ -236,7 +239,9 @@ show_extensions: true
236239{{{markdown}}}
237240 ` ;
238241
239- const infoMdTemplate = `---
242+ const infoMdTemplate = infoTemplate
243+ ? fs . readFileSync ( infoTemplate ) . toString ( )
244+ : `---
240245id: {{{id}}}
241246title: "{{{title}}}"
242247description: "{{{frontMatter.description}}}"
@@ -255,7 +260,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
255260\`\`\`
256261 ` ;
257262
258- const tagMdTemplate = `---
263+ const tagMdTemplate = tagTemplate
264+ ? fs . readFileSync ( tagTemplate ) . toString ( )
265+ : `---
259266id: {{{id}}}
260267title: "{{{frontMatter.description}}}"
261268description: "{{{frontMatter.description}}}"
@@ -272,7 +279,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
272279\`\`\`
273280 ` ;
274281
275- const schemaMdTemplate = `---
282+ const schemaMdTemplate = schemaTemplate
283+ ? fs . readFileSync ( schemaTemplate ) . toString ( )
284+ : `---
276285id: {{{id}}}
277286title: "{{{title}}}"
278287description: "{{{frontMatter.description}}}"
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ export const OptionsSchema = Joi.object({
3939 proxy : Joi . string ( ) ,
4040 outputDir : Joi . string ( ) . required ( ) ,
4141 template : Joi . string ( ) ,
42+ infoTemplate : Joi . string ( ) ,
43+ tagTemplate : Joi . string ( ) ,
44+ schemaTemplate : Joi . string ( ) ,
4245 downloadUrl : Joi . string ( ) ,
4346 hideSendButton : Joi . boolean ( ) ,
4447 showExtensions : Joi . boolean ( ) ,
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ export interface APIOptions {
3535 specPath : string ;
3636 outputDir : string ;
3737 template ?: string ;
38+ infoTemplate ?: string ;
39+ tagTemplate ?: string ;
40+ schemaTemplate ?: string ;
3841 downloadUrl ?: string ;
3942 hideSendButton ?: boolean ;
4043 showExtensions ?: boolean ;
You can’t perform that action at this time.
0 commit comments