-
Notifications
You must be signed in to change notification settings - Fork 889
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
/// # #![rustfmt::skip]
behaves weird
#6098
Comments
/// # #![rustfmt::skipp]
behaves weird/// # #![rustfmt::skip]
behaves weird
@max-ishere Thanks for reaching out. Currently there's no good way to skip formatting in a code block when using Writing for now I'll link the tracking issue #3348 |
For now I will leave the macro in, I think it may be the easiest solution for a list. I don't actually want to disable all formatting, just in the list so the ```ignore won't work. Also it's a doctest so it would have to be one of the rust code attrs anyway. |
I think a more complete solution would involve working with the rustdoc team to add an attribute that both tools understand as "rustfmt should skip this, but rustdoc should not". |
@ytmimi not following with your suggestion... |
Either way I hope the usecase is clear, mark something as do not format, but hide that marker in the docs. At the moment the nofmt macro is an ok alternative. |
Oh i see, like ```nofmt. That wont solve my usecase, but could work I guess. |
And to add to my previous comment, it has to be something you can enable for just one line, because all doc comments are formatted by rustfmt in my project and have some rules like line length 80 I think. |
I just wanted to keep specific formatting in my list. However it wasn't so easy...
skip
visible in the HTMLSource code
Rendered doc
This works, but I want to hide the formatting attribute
Hiding the
skip
Before save:
On save the list is formatted:
Another way to hide
skip
with a blockSource code
No difference on save, but its a new scope so now this variable is not avaliable to unformatted code.
Rendered HTML
Contains trailing
}
. If you hide the closing brace rustfmt will format the list.Using
nofmt::pls!{}
Source code
Rendered doc
Hiding
nofmt::pls!{}
Source code
No change on save.
Rendered doc
But this just looks weird, I want to try to put the open bracket on the same line as
=
. I don't want the doc to look completely unformatted, just a little bit in a subtle way so that my list is more readable.Making
nofmt::pls!{}
more hiddenSource code
On save:
Ouch... I think this is realted to #6025
Versions
The text was updated successfully, but these errors were encountered: