File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ export function myCustomIntroTemplateGenerator ( ) {
2+ return `---
3+ id: {{{id}}}
4+ title: "{{{title}}}"
5+ description: "{{{frontMatter.description}}}"
6+ {{^api}}
7+ sidebar_label: Introduction (custom)
8+ {{/api}}
9+ {{#api}}
10+ sidebar_label: "{{{title}}}"
11+ {{/api}}
12+ {{^api}}
13+ sidebar_position: 0
14+ {{/api}}
15+ hide_title: true
16+ {{#api}}
17+ hide_table_of_contents: true
18+ {{/api}}
19+ {{#json}}
20+ api: {{{json}}}
21+ {{/json}}
22+ {{#api.method}}
23+ sidebar_class_name: "{{{api.method}}} api-method"
24+ {{/api.method}}
25+ {{#infoPath}}
26+ info_path: {{{infoPath}}}
27+ {{/infoPath}}
28+ custom_edit_url: null
29+ {{#frontMatter.proxy}}
30+ proxy: {{{frontMatter.proxy}}}
31+ {{/frontMatter.proxy}}
32+ {{#frontMatter.hide_send_button}}
33+ hide_send_button: true
34+ {{/frontMatter.hide_send_button}}
35+ {{#frontMatter.show_extensions}}
36+ show_extensions: true
37+ {{/frontMatter.show_extensions}}
38+ {{#frontMatter.mask_credentials_disabled}}
39+ mask_credentials: false
40+ {{/frontMatter.mask_credentials_disabled}}
41+ ---
42+
43+ {{{markdown}}}
44+ ` ;
45+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
55
66import { DOCUSAURUS_VERSION } from "@docusaurus/utils" ;
77import { myCustomApiMdGenerator } from "./customMdGenerators" ;
8+ import { myCustomIntroTemplateGenerator } from "./customTemplateGenerators" ;
89
910const config : Config = {
1011 future : {
@@ -318,6 +319,9 @@ const config: Config = {
318319 downloadUrl : "/petstore-3.1.yaml" ,
319320 hideSendButton : false ,
320321 showSchemas : true ,
322+ templateGenerators : {
323+ createInfoTemplateMD : myCustomIntroTemplateGenerator ,
324+ } ,
321325 markdownGenerators : { createApiPageMD : myCustomApiMdGenerator } , // customize MDX with markdown generator
322326 } satisfies OpenApiPlugin . Options ,
323327 cos : {
You can’t perform that action at this time.
0 commit comments