Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Some saturday morning procrastination.
But I'm wondering how good an idea this is for plaintext: "Returns 'foo' on failure" is better than "Returns foo on failure", right? (With backticks instead of single quotes, phab is eating my formatting)
Maybe we should have an Emphasis flag or something on plaintext to preserve the quotes? (We don't want to include them e.g. in the return type chunks)
Also, realized our model for whitespace around paragraph chunks isn't ideal after all :-(
LGTM, thanks!
Regarding spaces between code and text chunks, are you suggesting we should print:
Tests primality of`p`
if so, i do believe having a space before the backtick vs not having it is two totally different rendering decisions. And I think the former is more common, why do you think we should not put that space?
I suppose we can modify the spacing logic for markdown to only put a separator between same chunk types, but I don't think that'll look any better especially in plugins like coc.nvim.
clang-tools-extra/clangd/Hover.cpp | ||
---|---|---|
873 | nit: s/Input/Line/ |
But I'm wondering how good an idea this is for plaintext: "Returns 'foo' on failure" is better than "Returns foo on failure", right? (With backticks instead of single quotes, phab is eating my formatting)
ah sorry missed that one.
That's actually a good point, I didn't dwell on it too much because I don't think having backticks in plaintext is that useful. But thinking about it again some people might find it useful especially in long
documentations to figure out which parts of it to focus on. So this might be a regression for them, it would be nice to have some feedback mechanism for driving such decisions. So far it has been just
the reviewer and the author of the patch :D
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?
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?
Ah I see, yes this looks annoying, and it is only because the next block starts with a punctuation :/
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?
Sorry I wasn't clear on my comment. I was also suggesting putting some markdown generated by us while parsing the documentation into this raw field, which would be rendered as-is. In case we would like to perform this for other markers like *.
So going with an emphasis-only solution is also OK.
Discussed offline, will follow up with fix for spaces and preserving backticks in text.
nit: s/Input/Line/