ruff
39281658 - [ty] Prevent type that is written with a code span from being incorrectly re-wrapped during docstring Markdown rendering (#26723)

Commit
7 days ago
[ty] Prevent type that is written with a code span from being incorrectly re-wrapped during docstring Markdown rendering (#26723) <!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? - Does this PR follow our AI policy (https://github.com/astral-sh/.github/blob/main/AI_POLICY.md)? --> ## Summary This does two things: 1. (abe15fe4) It refactors and consolidates the helpers that we use for parsing runs of backticks (which denote the opening and closing of Markdown fences). This lays a foundation for [rendering Google- and NumPy- style docstrings](https://github.com/astral-sh/ty/issues/1667)[^1]. 2. (3acd8a4d) It fixes a bug in Markdown rendering for reStructuredText docstrings. Previously the parameter type in the following docstring would incorrectly be rendered as a code span containing literal backticks (i.e., `` `str` ``), because we would re-wrap the type in another set of backticks: ```text :param value: The value. :type value: `str` ``` With this change, we now output a type that is already wrapped verbatim (so that the above example renders as `str`). [^1]: Google- and NumPy- style docstrings may contain types that are already wrapped in code spans: ```text Args: value (`str`): The value. ``` ```text Parameters ---------- value : `str` The value. ``` ## Test Plan See included tests. <!-- How was it tested? -->
Author
Parents
Loading