Skip to content

Commit fe677d4

Browse files
committed
Add custom templates instructions
1 parent 5fafa7a commit fe677d4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,34 @@ oad gen-docs -s source-openapi.json -d schemas.wsd --style "PLANTUML_API"
7373

7474
_Example of PlantUML diagram generated from path items._
7575

76+
#### Using custom templates
77+
78+
You can override the default templates by providing a custom templates directory:
79+
80+
```bash
81+
oad gen-docs -s source-openapi.json -d output.md -T ./my-templates/
82+
```
83+
84+
The custom templates directory should contain template files with the same names as the built-in templates. Any template file found in the custom directory will override the corresponding default template, while non-overridden templates will use the defaults. This follows the same pattern as [MkDocs template customization](https://www.mkdocs.org/user-guide/customizing-your-theme/#overriding-template-blocks).
85+
86+
**Important:** The custom templates directory must match the output style being rendered. Each style (MKDOCS, MARKDOWN, PLANTUML_SCHEMAS, PLANTUML_API) has its own template structure. You need to provide templates appropriate for the `--style` parameter you're using.
87+
88+
**Template structure:**
89+
- `layout.html` - Main layout template
90+
- `partial/` - Directory containing reusable template components
91+
92+
**Example custom template directory structure:**
93+
```
94+
my-templates/
95+
├── layout.html # Overrides main layout
96+
└── partial/
97+
├── info.html # Overrides info section
98+
└── path-items.html # Overrides path items section
99+
```
100+
101+
All templates use [Jinja2](https://jinja.palletsprojects.com/) syntax and have access to the same filters, functions, and context variables as the built-in templates.
102+
103+
76104
### Goals
77105

78106
* Provide an API to generate OpenAPI Documentation files.

0 commit comments

Comments
 (0)