Skip to content

Comments

docs: add code fences to Example: docstring blocks#2104

Merged
Kludex merged 1 commit intomodelcontextprotocol:mainfrom
jonathanhefner:api-docs-code-fences
Feb 19, 2026
Merged

docs: add code fences to Example: docstring blocks#2104
Kludex merged 1 commit intomodelcontextprotocol:mainfrom
jonathanhefner:api-docs-code-fences

Conversation

@jonathanhefner
Copy link
Member

Docstrings using Example: sections had indented code without triple-backtick fences, causing mkdocs to render them as prose paragraphs instead of code blocks.

  • Wrap all unfenced example code in python ... blocks
  • Rename Example usage: and Example Usage: to Example: so griffe recognizes them as proper docstring sections
  • Normalize Examples: (plural) to Example: (singular) for consistent mkdocs rendering
  • Split multi-example blocks into separate fenced blocks with prose labels where appropriate (_httpx_utils.py, server.py, experimental.py, task_support.py)

Docstrings using `Example:` sections had indented code without
triple-backtick fences, causing mkdocs to render them as prose
paragraphs instead of code blocks.

- Wrap all unfenced example code in `python ... ` blocks
- Rename `Example usage:` and `Example Usage:` to `Example:` so griffe
  recognizes them as proper docstring sections
- Normalize `Examples:` (plural) to `Example:` (singular) for consistent
  mkdocs rendering
- Split multi-example blocks into separate fenced blocks with prose
  labels where appropriate (`_httpx_utils.py`, `server.py`,
  `experimental.py`, `task_support.py`)
Copy link
Member

@Kludex Kludex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Best PRs! 🙏

@Kludex Kludex merged commit cb07ade into modelcontextprotocol:main Feb 19, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants