We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e814e3 commit 99b30baCopy full SHA for 99b30ba
crates/ide-db/src/documentation.rs
@@ -138,15 +138,13 @@ pub fn docs_from_attrs(attrs: &hir::Attrs) -> Option<String> {
138
for doc in docs {
139
// str::lines doesn't yield anything for the empty string
140
if !doc.is_empty() {
141
- buf.extend(Itertools::intersperse(
142
- doc.lines().map(|line| {
143
- line.char_indices()
144
- .nth(indent)
145
- .map_or(line, |(offset, _)| &line[offset..])
146
- .trim_end()
147
- }),
148
- "\n",
149
- ));
+ // We don't trim trailing whitespace from doc comments as multiple trailing spaces
+ // indicates a hard line break in Markdown.
+ let lines = doc.lines().map(|line| {
+ line.char_indices().nth(indent).map_or(line, |(offset, _)| &line[offset..])
+ });
+
+ buf.extend(Itertools::intersperse(lines, "\n"));
150
}
151
buf.push('\n');
152
0 commit comments