You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
config's default output format might not render as expected #12960
Currently, the output of a config command is something like this:
>>> subprocess.getoutput(['ruff', 'config', 'lint.preview'])
'Whether to enable preview mode. When preview mode is enabled, Ruff will\nuse unstable rules and fixes.\n\nDefault value: false\nType: bool\nExample usage:\n```toml\n# Enable preview features.\npreview = true\n```'
In the terminal, this looks nice:
Whether to enable preview mode. When preview mode is enabled, Ruff will
use unstable rules and fixes.
Default value: false
Type: bool
Example usage:
```toml# Enable preview features.preview = true```
However, when rendered, the "Default value", "Type" and "Example usage" lines are collapsed into a single <p> (Commonmark dingus):
<p>Whether to enable preview mode. When preview mode is enabled, Ruff will
use unstable rules and fixes.</p><p>Default value: false
Type: bool
Example usage:</p><pre><codeclass="language-toml"># Enable preview features.
preview = true
</code></pre>
For example, here's how PyCharm renders it:
A possible fix is to append two spaces to the end of the first two lines in question (Commonmark dingus):
Note: Backslashes also work as markdown newline indicators (and are more obvious than double spaces) demo. But if the goal is to also display the same string in a terminal, then yeah two spaces is probably the best.
changed the title [-]`config`'s default output format doesn't render very nicely[/-][+]`config`'s default output format might not render as expected[/+]on Aug 18, 2024
Thanks for opening this issue. I agree, the output in PyCharm isn't ideal.
I assume that the hover text in PyCharm comes from the JSON schema. If that's the case, I would prefer a local change in the schema generation to use \ over the somewhat obscure use of two spaces at the end of the line.
It wasn't the schema (it would have been great if that was the case, though); I triggered the renderer semi-manually. (Yes, I could have asked for the JSON and put it together myself, too, but that's beside the point.)
It turned out that the format wasn't as nice compared to other popups of the same kind, so I rendered it manually anyway. It took more efforts than I expected, but behold the result:
I'll keep this issue open, though, since someone else might need it.
Activity
Avasam commentedon Aug 18, 2024
Note: Backslashes also work as markdown newline indicators (and are more obvious than double spaces) demo. But if the goal is to also display the same string in a terminal, then yeah two spaces is probably the best.
[-]`config`'s default output format doesn't render very nicely[/-][+]`config`'s default output format might not render as expected[/+]MichaReiser commentedon Aug 18, 2024
Thanks for opening this issue. I agree, the output in PyCharm isn't ideal.
I assume that the hover text in PyCharm comes from the JSON schema. If that's the case, I would prefer a local change in the schema generation to use
\over the somewhat obscure use of two spaces at the end of the line.InSyncWithFoo commentedon Aug 18, 2024
It wasn't the schema (it would have been great if that was the case, though); I triggered the renderer semi-manually. (Yes, I could have asked for the JSON and put it together myself, too, but that's beside the point.)
Submitting a PR.
charliermarsh commentedon Aug 18, 2024
@MichaReiser -- Is there still something to do here given the PR was closed?
MichaReiser commentedon Aug 19, 2024
ruff configonly supports the output formattextandjson. The ask in this issue is to add amarkdownoutput format.InSyncWithFoo commentedon Aug 21, 2024
It turned out that the format wasn't as nice compared to other popups of the same kind, so I rendered it manually anyway. It took more efforts than I expected, but behold the result:
I'll keep this issue open, though, since someone else might need it.
MichaReiser commentedon Aug 22, 2024
This looks great!