[PATCH] D77456: [clangd] Parse `foo` in documentation comments and render as code.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 16:33:36 PDT 2020


sammccall added a comment.

In D77456#1961374 <https://reviews.llvm.org/D77456#1961374>, @kadircet wrote:

> LGTM, thanks!
>
> Regarding spaces between code and text chunks, are you suggesting we should print:
>
>   Tests primality of`p`
>


No, I'm complaining about the space before the period in

  Tests primality of `p` .

and the plaintext rendering too

  Tests primality of p .



> So having a raw paragraph chunk(in addition to plaintext and inline code). might be a middle ground here. Plaintext renderers will keep showing the documentation as it is written in the source code, including backticks, whereas markdown renderers would display a more rich text. WDYT?

Two main objections to the idea of "raw":

- we're going to emit arbitrary, potentially malformed markdown into the markdown stream, which can have arbitrary effects/glitches. I'd rather the emitter always emits valid markup and thus can't lose track of the context.
- this assumes the input is markdown. I want `\c foo` to also render as code-font `foo` in markdown and as backtick-foo in plaintext. So what do we do there, generate markdown as a string and then emit it as a raw chunk? What a mess.

I really do think what we want is a chunk with semantics "emphasized code" that renders as a code span in markdown and as backtick-delimited text in plaintext. Thus the proposal to put an emphasis bit on the code chunk. WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77456





More information about the cfe-commits mailing list