📝 Update details syntax with new pymdown extensions format (#713)

This commit is contained in:
Sebastián Ramírez
2023-11-28 23:12:33 +01:00
committed by GitHub
parent be464fba69
commit 799d0aa7a6
37 changed files with 409 additions and 614 deletions

View File

@@ -14,14 +14,13 @@ Up to now, we have been creating a session in each *path operation*, in a `with`
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/delete/tutorial001.py!}
```
</details>
///
That's perfectly fine, but in many use cases we would want to use <a href="https://fastapi.tiangolo.com/tutorial/dependencies/" class="external-link" target="_blank">FastAPI Dependencies</a>, for example to **verify** that the client is **logged in** and get the **current user** before executing any other code in the *path operation*.
@@ -43,14 +42,13 @@ It could use `yield` instead of `return`, and in that case **FastAPI** will make
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!}
```
</details>
///
## Use the Dependency
@@ -72,14 +70,13 @@ We import `Depends()` from `fastapi`. Then we use it in the *path operation func
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!}
```
</details>
///
/// tip
@@ -121,14 +118,13 @@ This means that in the main code of the *path operation function*, it will work
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!}
```
</details>
///
In fact, you could think that all that block of code inside of the `create_hero()` function is still inside a `with` block for the **session**, because this is more or less what's happening behind the scenes.
@@ -148,14 +144,13 @@ But now, the `with` block is not explicitly in the function, but in the dependen
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!}
```
</details>
///
We will see how this is very useful when testing the code later. ✅
@@ -183,14 +178,13 @@ And then we remove the previous `with` block with the old **session**.
{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-106]!}
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!}
```
</details>
///
## Recap