enhanced-github icon indicating copy to clipboard operation
enhanced-github copied to clipboard

feature request: wrap long lines inside markdown code blocks

Open timotheecour opened this issue 3 years ago • 2 comments

See linked issue for the problem description: https://stackoverflow.com/questions/41238148/how-to-line-wrap-long-lines-inside-markdown-code-blocks-in-githubgitlab/67544049#67544049

Given the number of upvotes, it's a commonly requested feature.

The goal is to wrap code blocks, eg:

some very long line; some very long line; some very long line; some very long line; some very long line; some very long line; some very long line; some very long line; some very long line; some very long line; 

See also https://github.com/yoheimuta/github-pre-utility which is relevant.

timotheecour avatar May 16 '21 18:05 timotheecour

Has this feature been added? Is there a (built-in?) way to wrap texts inside the code block now?

bioXiaoheng avatar Sep 07 '21 22:09 bioXiaoheng

old workaround:

for now: <code>....</code>, which is an inline element can help you with that. note that similar to pre, it will display the content as is, this means you can include EM/STRONG/SUB/SUP,etc... inside it. this also means that it is not text-encoding your content, so make sure to do it yourself. it also isn't applying any styling, it just shows a lot of text (including one with newlines in) across multiple lines.

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

it will favor whitespace for line-breaks otherwise if non exists it will simply wrap at character limit per-line (flows depending on the size of the container), you can not force it not to break on spaces but you can use &nbsp; instead of space, but as explained above, if it happens to reach the line end it may break on it anyway.

note: if there are too much (2+) new lines, github will insert a newline in-it, breaking the code tag, so always preview first, you can also insert BR or HR tags in instead of linebreaks you would normally have.

eladkarako avatar Feb 09 '22 20:02 eladkarako