Skip to content

Conversation

hunterhogan
Copy link
Contributor

gh-133046: Fix ast module docstring markup for better rendering in VS Code

This PR updates the ast module docstring to use --- instead of ~~~ for section headers. This change improves the docstring rendering in Visual Studio Code and similar tools, as discussed in issue #133046.

See: #133046

@python-cla-bot
Copy link

python-cla-bot bot commented Apr 27, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Apr 27, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@hunterhogan hunterhogan changed the title Fix formatting in module docstring for ast https://github.com/python/cpython/issues/133046 Fix formatting in module docstring for ast https://github.com/python/cpython/issues/133046 gh-133046 133046 Apr 27, 2025
@picnixz picnixz changed the title Fix formatting in module docstring for ast https://github.com/python/cpython/issues/133046 gh-133046 133046 gh-133046: Fix formatting in module docstring for ast Apr 27, 2025
@picnixz picnixz changed the title gh-133046: Fix formatting in module docstring for ast gh-133046: Fix formatting in ast module docstring Apr 27, 2025
@picnixz picnixz changed the title gh-133046: Fix formatting in ast module docstring gh-133046: Fix ast module docstring Apr 27, 2025
@picnixz
Copy link
Member

picnixz commented Apr 27, 2025

Quick question but are there other modules with that issue?

@picnixz picnixz changed the title gh-133046: Fix ast module docstring gh-133046: Fix heading in ast module docstring Apr 27, 2025
@tomasr8
Copy link
Member

tomasr8 commented Apr 27, 2025

I only found pyspecific, but that one is internal.

@hugovk
Copy link
Member

hugovk commented Apr 27, 2025

This is an easy enough fix, but feels like a bug in VS Code.

Have you reported it to VS Code?

There could be other projects also using tildes as underlines, as the tilde is a valid and recommended underline character for sections in reStructuredText:

Specifically, an underline/overline character may be any non-alphanumeric printable 7-bit ASCII character [7].

[7] The following are all valid section title adornment characters:

! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~

Some characters are more suitable than others. The following are recommended:

= - ` : . ' " ~ ^ _ * + #

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#sections

@ZeroIntensity
Copy link
Member

reStructuredText

I think it's interpreting it as markdown, not RST.

@AA-Turner
Copy link
Member

Closing as churn, this should be fixed in VS Code.

A

@AA-Turner AA-Turner closed this Apr 27, 2025
@picnixz
Copy link
Member

picnixz commented Apr 27, 2025

I only found pyspecific, but that one is internal.

Let's change it in another PR if @AA-Turner wants to.

@hunterhogan hunterhogan deleted the ast_docstring_syntax_133046 branch April 27, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants