[clang-tools-extra] [clangd] Improve Markup Rendering (PR #140498)
Maksim Ivanov via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 11 19:45:15 PDT 2025
================
@@ -151,16 +151,91 @@ bool needsLeadingEscape(char C, llvm::StringRef Before, llvm::StringRef After,
}
}
+/// \brief Tests whether \p C should be backslash-escaped in markdown.
+///
+/// The MarkupContent LSP specification defines that `markdown` content needs to
+/// follow GFM (GitHub Flavored Markdown) rules. And we can assume that markdown
+/// is rendered on the client side. This means we do not need to escape any
+/// markdown constructs.
+/// The only exception is when the client does not support HTML rendering in
+/// markdown. In that case, we need to escape HTML tags and HTML entities.
+///
+/// **FIXME:** handle the case when the client does support HTML rendering in
+/// markdown. For this, the LSP server needs to check the
+/// [supportsHtml
+/// capability](https://github.com/microsoft/language-server-protocol/issues/1344)
+/// of the client.
+///
+/// \param C The character to check.
+/// \param After The string that follows \p C .
+// This is used to determine if \p C is part of a tag or an entity reference.
----------------
emaxx-google wrote:
nit: Use triple-slash here as well, for consistency with the rest of the comment.
https://github.com/llvm/llvm-project/pull/140498
More information about the cfe-commits
mailing list