-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Handling of newline in RustDoc #120
Comments
As I described in #129, I would personally like the default behaviour to use the raw doc comment. It should definitely be an option at least. For my project I am currently working off of a fork to get this functionality: diff I'd be happy to submit a PR for this. Please let me know what you'd like to see implemented |
There's really no good reason to strip excess newlines. By the CommonMark spec, these should already be treated as soft line breaks and handled during rendering: https://spec.commonmark.org/0.30/#softbreak |
What about if we want the new lines? For instance, I have the following in my docs:
and I want to explicitly have the new lines come through so the bullet points get rendered out correctly. Would there be a keyword per line I could use to "opt-in" for a new line? |
Hey @GREsau 👋 For this purpose we have multiline rustdoc comments with markdown, examples and more complex content. As newlines get stripped and this breaks our process and we needed to temporary fork this crate to "unbrick". We would be willing to provide a PR or support you wherever needed on this topic. We tried to solve it with a custom visitor but the newline removal happened before the custom visitor sees the data. Any chance for this to be configurable and to land in the 1.0 release? Right now we naively disabled the newline stripping in the temporary fork. |
Finally, as of schemars v1.0.0-alpha.3, whitespace from doc comments is no longer collapsed when generating a schema's |
@lorenzolewis this is obviously quite a bit late, but for posterity: you can get a hard line break by leaving two trailing spaces at the end of the line. It's in the same section of the Commonmark spec I linked before:
(Emphasis mine.) |
Should or should we not change the default parsing behavior from the current (removing single
\n
in RustDoc)to just leaving the newline in.
To clarify for everyone we are talking about:
Should this result in:
This question came up in: #38
#38 (comment)
A
Visitor
can be created to do this behavior and users can enable or disable it as they want.But the default has to be one way or the other. (to be decided in this issue)
The text was updated successfully, but these errors were encountered: