This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Preserve line break when rendering text chunks of markdown
Needs ReviewPublic

Authored by ilya-biryukov on Aug 12 2019, 6:27 AM.

Event Timeline

ilya-biryukov created this revision.Aug 12 2019, 6:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2019, 6:27 AM

Added a bit of a braindump to https://github.com/clangd/clangd/issues/95

I think always forcing a break is maybe at least as bad as forcing no break, and we should aim to be cleverer.
Some (relatively) simple punctuation/capitalization/line-length based heuristics may get us a long way here - is it ok to punt on this for a while?

This change would be consistent with how we handle plaintext, but including the breaks seems less problematic there: it's not clear editors are supposed to rewrap plaintext if we unwrap it, whereas markdown is very clear about that.

The heuristics for properly rendering the comments are probably a good way to go.
I'd say this change is still a step in the right direction - text blocks in formatted strings should be properly escaped to avoid being interpreted like markdown constructs.
Any structure we want to have should be explicit.

However, landing this without the aforementioned heuristics means changing our behavior and since some folks like the current one better, I'll just keep this change in a limbo until we get to those heuristics.