leostera / tldr.jsx

📚 A Reactive web client for tldr-pages
https://tldr.ostera.io
MIT License
1.54k stars 75 forks source link

Code blocks do not wrap lines, such as shell blocks.(```shell code ```) #171

Closed itldr closed 3 years ago

itldr commented 3 years ago

Code blocks do not wrap lines, such as shell blocks.(shell code) image

bl-ue commented 3 years ago

@itldr it seems to me that this is intentional. That's what GitHub itself does, e.g.:

Screen Shot 2021-02-24 at 9 15 19 PM

The code block (denoted by three tildes: ```...```) is a separate entity, and not supposed to have word wrap, whereas the inline code (denoted by one tilde: `...`) is just a normal sentence except it's styled as code, and therefore it should be wrapped as normal sentences are.

bl-ue commented 3 years ago

Note:

Inline, three tildes (```) has the same effect as a single tilde (`). e.g: this is made by three tildes: code, this is made by one tilde: code.

When opening ``` is on one line and the closing ``` is on another, it becomes a code block:

code

Not so, though, for the single tilde:

code

itldr commented 3 years ago

Note:

Inline, three tildes (``) has the same effect as a single tilde (). e.g: this is made by three tildes: code, this is made by one tilde: code.

When opening is on one line and the closing is on another, it becomes a code block:

code

Not so, though, for the single tilde:

code

What you said is very reasonable. Thank you.However, if each line of code in the block is too long, it will feel incongruous to display it on the page.

bl-ue commented 3 years ago

Then, I think you should always use single tildes (`) for these pages. That should make word wrap always happen.

itldr commented 3 years ago

Then, I think you should always use single tildes (`) for these pages. That should make word wrap always happen.

Yes, I should use (`) more than (```) .For me (```) is a convenient way to write it, maybe I'm lazy, haha.You always know so much, and I will continue to learn from you.thank you!