Browse Source

📝 Fix out-of-range highlight lines in docs code embeds

Three docs `{* file hl[a:b] *}` embeds set the inclusive upper bound one
line past the end of the referenced file:

- `advanced/response-headers.md`: `hl[10:12]` -> `hl[10:11]`
  (`docs_src/response_headers/tutorial001_py310.py` is 11 lines)
- `advanced/websockets.md`: `hl[48:52]` -> `hl[48:51]`
  (`docs_src/websockets_/tutorial001_py310.py` is 51 lines)
- `tutorial/body-updates.md`: `hl[28:33]` -> `hl[28:32]`
  (`docs_src/body_updates/tutorial001_py310.py` is 32 lines)

The rendered output is unchanged since the nonexistent trailing line was
silently dropped; this corrects the ranges to the intended last line.
pull/15814/head
Patrick Wehbe 1 month ago
parent
commit
6b90944736
  1. 2
      docs/en/docs/advanced/response-headers.md
  2. 2
      docs/en/docs/advanced/websockets.md
  3. 2
      docs/en/docs/tutorial/body-updates.md

2
docs/en/docs/advanced/response-headers.md

@ -22,7 +22,7 @@ You can also add headers when you return a `Response` directly.
Create a response as described in [Return a Response Directly](response-directly.md) and pass the headers as an additional parameter:
{* ../../docs_src/response_headers/tutorial001_py310.py hl[10:12] *}
{* ../../docs_src/response_headers/tutorial001_py310.py hl[10:11] *}
/// note | Technical Details

2
docs/en/docs/advanced/websockets.md

@ -58,7 +58,7 @@ You could also use `from starlette.websockets import WebSocket`.
In your WebSocket route you can `await` for messages and send messages.
{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:51] *}
You can receive and send binary, text, and JSON data.

2
docs/en/docs/tutorial/body-updates.md

@ -6,7 +6,7 @@ To update an item you can use the [HTTP `PUT`](https://developer.mozilla.org/en-
You can use the `jsonable_encoder` to convert the input data to data that can be stored as JSON (e.g. with a NoSQL database). For example, converting `datetime` to `str`.
{* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *}
{* ../../docs_src/body_updates/tutorial001_py310.py hl[28:32] *}
`PUT` is used to receive data that should replace the existing data.

Loading…
Cancel
Save