Skip to content

ruff_python_formatter: add test for extraneous info string text#9050

Merged
BurntSushi merged 1 commit intomainfrom
ag/fmt/markdown-additional-info-string
Dec 8, 2023
Merged

ruff_python_formatter: add test for extraneous info string text#9050
BurntSushi merged 1 commit intomainfrom
ag/fmt/markdown-additional-info-string

Conversation

@BurntSushi
Copy link
Member

@ofek asked about this. I did specifically add support for it, but neglected to add a test. This PR adds a test.

@ofek asked [about this][ref]. I did specifically add support for it,
but neglected to add a test. This PR adds a test.

[ref]: #9030 (comment)
@BurntSushi BurntSushi added internal An internal refactor or improvement docstring Related to docstring linting or formatting formatter Related to the formatter labels Dec 7, 2023
@BurntSushi BurntSushi added this to the Formatter: Stable milestone Dec 7, 2023
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Nice

@ofek
Copy link
Contributor

ofek commented Dec 7, 2023

Awesome, thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2023

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

TIL that you can have additional text after the language specifier

@ofek
Copy link
Contributor

ofek commented Dec 8, 2023

Not in pure Markdown but extensions do support that frequently to do various things!

@BurntSushi
Copy link
Member Author

BurntSushi commented Dec 8, 2023

Not in pure Markdown but extensions do support that frequently to do various things!

Assuming pure Markdown is CommonMark, the extra text after the opening fences is called the "info string" and it does indeed permit for pretty much anything to go there. There are even examples in the spec. See: https://spec.commonmark.org/0.30/#fenced-code-blocks

The spec doesn't attach any semantic value to any part of the "info string," it just specifies what is allowed there. For example, when using backticks for a fenced code block, the info string itself cannot contain backticks. But it can if you use tildes!

@BurntSushi BurntSushi merged commit a224f19 into main Dec 8, 2023
@BurntSushi BurntSushi deleted the ag/fmt/markdown-additional-info-string branch December 8, 2023 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docstring Related to docstring linting or formatting formatter Related to the formatter internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants