Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruff_python_formatter: add test for extraneous info string text #9050

Merged
merged 1 commit into from
Dec 8, 2023

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!

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
17 checks passed
@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