Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
patrickwehbe wants to merge 1 commit into
fastapi:masterfrom
patrickwehbe:fix-docs-highlight-ranges
Open

📝 Fix out-of-range highlight lines in docs code embeds#15814
patrickwehbe wants to merge 1 commit into
fastapi:masterfrom
patrickwehbe:fix-docs-highlight-ranges

Conversation

@patrickwehbe

Copy link
Copy Markdown

Three docs {* file hl[a:b] *} embeds set the inclusive hl upper bound one line past the end of the referenced file. In each case the intended block ends at the file's last line, so the upper bound should be one lower.

File Referenced source Lines in file Was Now
docs/en/docs/advanced/response-headers.md docs_src/response_headers/tutorial001_py310.py 11 hl[10:12] hl[10:11]
docs/en/docs/advanced/websockets.md docs_src/websockets_/tutorial001_py310.py 51 hl[48:52] hl[48:51]
docs/en/docs/tutorial/body-updates.md docs_src/body_updates/tutorial001_py310.py 32 hl[28:33] hl[28:32]

The corrected ranges still cover the same intended code (the response/header lines, the WebSocket endpoint body, and the PUT handler respectively).

The rendered docs are not affected: the phantom line is past end-of-file and was silently dropped, so the highlighted output already looked correct. This is just a range-correctness fix so the embed bounds match the files they point at.

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.
@github-actions github-actions Bot added the docs Documentation about how to use FastAPI label Jun 20, 2026
mohamedtaqysalmi

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation about how to use FastAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants