[clang-tools-extra] [clangd] Improve Markup Rendering (PR #140498)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 27 07:29:16 PDT 2025


================
@@ -118,8 +138,8 @@ class Document {
   BulletList &addBulletList();
 
   /// Doesn't contain any trailing newlines.
-  /// We try to make the markdown human-readable, e.g. avoid extra escaping.
-  /// At least one client (coc.nvim) displays the markdown verbatim!
----------------
tcottin wrote:

>A single blank line between paragraphs sounds OK. Or do you mean adding another blank line in between, or a trailing blank line at the end? - that might look extraneous. In any case, that sounds like a relatively minor implementation detail that we can discuss further as the PR goes.

I mean in between.

Multiple newlines in a comment used to be "collapsed" to a single newline, resulting in removed paragraph separation in Markdown:

```c
/**
 * paragraph1 line1
 * paragraph1 line2
 *
 * paragraph2 line1
 */
```

Hover looked like this:

```
paragraph1 line1 paragraph1 line2
paragraph2 line1
```

With the change, paragraphs are now seperated by an empty line (as per Markdown specification).

```
paragraph1 line1 paragraph1 line2

paragraph2 line1
```

Trailing newlines are always trimmed. This did not change.

https://github.com/llvm/llvm-project/pull/140498


More information about the cfe-commits mailing list