mirror of https://github.com/tiangolo/fastapi.git
📝 Update includes in `docs/en/docs/how-to/custom-docs-ui-assets.md` (#12557)
This commit is contained in:
parent
04194dc191
commit
95ebac1a89
|
|
@ -18,9 +18,7 @@ The first step is to disable the automatic docs, as by default, those use the de
|
|||
|
||||
To disable them, set their URLs to `None` when creating your `FastAPI` app:
|
||||
|
||||
```Python hl_lines="8"
|
||||
{!../../docs_src/custom_docs_ui/tutorial001.py!}
|
||||
```
|
||||
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[8] *}
|
||||
|
||||
### Include the custom docs
|
||||
|
||||
|
|
@ -36,9 +34,7 @@ You can reuse FastAPI's internal functions to create the HTML pages for the docs
|
|||
|
||||
And similarly for ReDoc...
|
||||
|
||||
```Python hl_lines="2-6 11-19 22-24 27-33"
|
||||
{!../../docs_src/custom_docs_ui/tutorial001.py!}
|
||||
```
|
||||
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[2:6,11:19,22:24,27:33] *}
|
||||
|
||||
/// tip
|
||||
|
||||
|
|
@ -54,9 +50,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
|
|||
|
||||
Now, to be able to test that everything works, create a *path operation*:
|
||||
|
||||
```Python hl_lines="36-38"
|
||||
{!../../docs_src/custom_docs_ui/tutorial001.py!}
|
||||
```
|
||||
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[36:38] *}
|
||||
|
||||
### Test it
|
||||
|
||||
|
|
@ -158,9 +152,7 @@ The same as when using a custom CDN, the first step is to disable the automatic
|
|||
|
||||
To disable them, set their URLs to `None` when creating your `FastAPI` app:
|
||||
|
||||
```Python hl_lines="9"
|
||||
{!../../docs_src/custom_docs_ui/tutorial002.py!}
|
||||
```
|
||||
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[9] *}
|
||||
|
||||
### Include the custom docs for static files
|
||||
|
||||
|
|
@ -176,9 +168,7 @@ Again, you can reuse FastAPI's internal functions to create the HTML pages for t
|
|||
|
||||
And similarly for ReDoc...
|
||||
|
||||
```Python hl_lines="2-6 14-22 25-27 30-36"
|
||||
{!../../docs_src/custom_docs_ui/tutorial002.py!}
|
||||
```
|
||||
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[2:6,14:22,25:27,30:36] *}
|
||||
|
||||
/// tip
|
||||
|
||||
|
|
@ -194,9 +184,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
|
|||
|
||||
Now, to be able to test that everything works, create a *path operation*:
|
||||
|
||||
```Python hl_lines="39-41"
|
||||
{!../../docs_src/custom_docs_ui/tutorial002.py!}
|
||||
```
|
||||
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[39:41] *}
|
||||
|
||||
### Test Static Files UI
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue