Skip to content

[ty] improve indented codefence rendering in docstrings#22408

Merged
Gankra merged 1 commit intomainfrom
gankra/mdblock2
Jan 6, 2026
Merged

[ty] improve indented codefence rendering in docstrings#22408
Gankra merged 1 commit intomainfrom
gankra/mdblock2

Conversation

@Gankra
Copy link
Contributor

@Gankra Gankra commented Jan 5, 2026

By stripping leading indents from codefence lines to ensure they're properly understood by markdown (but otherwise preserving the indent in the codeblock so all the code renders roughly at the right indent).

As described in this comment this solution is very "do what I mean" for when a user has an explicit markdown codeblock in e.g. a Returns: section which "has" to be indented but that indent makes the verbatim codefence invalid markdown.

@Gankra Gankra added server Related to the LSP server ty Multi-file analysis & type inference labels Jan 5, 2026
@Gankra
Copy link
Contributor Author

Gankra commented Jan 5, 2026

We are now entering the "Aria creates a non-standard dialect of markdown" era of Astral.

@Gankra
Copy link
Contributor Author

Gankra commented Jan 5, 2026

I would be perfectly fine with the conclusion being "the user isn't allowed to do that" but idk it seems sensible..?

Comment on lines +1286 to +1294
Returns:
    Some details
~~~~~~python
x_y = thing_do();
~~~ # this should't close the fence!
a_b = other_thing();
~~~~~~
    And so on.
");
Copy link
Member

Choose a reason for hiding this comment

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

Can you share a screenshot for how e.g. VS Code renders this markdown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2026-01-06 at 10 42 11 AM

@AlexWaygood AlexWaygood removed their request for review January 6, 2026 15:44
@Gankra Gankra merged commit 98728b2 into main Jan 6, 2026
46 checks passed
@Gankra Gankra deleted the gankra/mdblock2 branch January 6, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown code blocks rendering space as HTML code on Docstrings

2 participants