[PATCH] D75687: [clangd] Only minimally escape text when rendering to markdown.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 00:08:43 PDT 2020


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks, lgtm!



================
Comment at: clang-tools-extra/clangd/FormattedString.cpp:150
+    // Not a delimiter if surrounded by space.
+    return !SpaceSurrounds();
+  case '-': // Setex heading, horizontal ruler, or bullet.
----------------
kadircet wrote:
> `_` seems to behave different than `*` :(
> 
> it seems to rather depend on the spaces around the text being emphasized, i.e
> 
> ```
> foo _ bar _ foo -> no emphasis
> foo _ bar_ foo -> no emphasis
> foo _bar_ foo -> emphasis on bar
> foo_bar_ foo -> no emphasis
> ```
> 
> so this should rather be `Before.endswith(" ") && isAlpha(After)` for the beginning of emphasis and the opposite for the ending.
> Not sure if there's an easy way to decide on it in isolation.
regarding this one, i suppose we'll just be escaping in some unnecessary cases(like the 2nd and the 4th), but still better than the current state so nvm.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75687/new/

https://reviews.llvm.org/D75687





More information about the cfe-commits mailing list