Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code blocks (I think?) don't word wrap #1556

Open
machinaeZER0 opened this issue Sep 9, 2024 · 4 comments
Open

Code blocks (I think?) don't word wrap #1556

machinaeZER0 opened this issue Sep 9, 2024 · 4 comments

Comments

@machinaeZER0
Copy link
Collaborator

Apologies if these are a different element than a code block! I've noticed for some time that the type of text shown below displays as a single line on mobile unless line breaks are manually entered - scrollable, but not super ideal presentation wise.

Screenshot_20240909-124109.png
(Post in question can be viewed here: https://lemmy.zip/post/22426238)

Is it possible to tweak this behavior, or is it technically a feature of that particular formatting?

@machinaeZER0 machinaeZER0 changed the title Code blocks (I think?) don't word wrap on mobile Code blocks (I think?) don't word wrap Sep 9, 2024
@micahmo
Copy link
Member

micahmo commented Sep 9, 2024

Hey @machinaeZER0, thanks for the question! I won't say that we would never implement an option for wrapping code blocks, but I will say that it's very intentional that they don't wrap. When you're dealing with code, line breaks often have specific meaning, and you don't want any additional ones to be introduced automatically by the tool you're using to view the code. That's exactly why there's a separate option in markdown for code formatting: so that it doesn't get altered in any unintentional way.

You'll notice that the Lemmy web UI renders the code blocks in exactly the same way. Even though my monitor is obviously much wider than my phone, I still have to scroll horizontally to view all of the text.

image

In my opinion, the real problem is that the poster used a code block at all, since they weren't referencing code. They should have used a quote block, which is perfect for quoting text, as they were doing, and it would wrap the text.

I hope that makes sense, and I hope it doesn't come across as putting down your request at all. I just wanted to provide some clarification for why things work the way they do.

@machinaeZER0
Copy link
Collaborator Author

Thank you, I had a feeling this might be the case! Do you think it would be more trouble than it's worth to have a "word wrap code blocks" option in settings? I could see it being a handy option for laypeople who aren't coders/a good catch all option since people will misuse code blocks in this way from time to time.

Obviously the people posting should be using the right block for the right tool, so I can totally see why we wouldn't want to "waste" dev hours on supporting unintended behavior, so mostly just thinking out loud :) either way, appreciate your reply/explanation (as always)!

@micahmo
Copy link
Member

micahmo commented Sep 9, 2024

Do you think it would be more trouble than it's worth to have a "word wrap code blocks" option in settings?

I don't think that's a bad idea at all. We can keep this issue open for just that request. However I just can't promise that it'll be a high priority.

P.S. One tip that might help is to long-press > Text Actions > View Comment Source. The comment will be displayed in raw markdown, and it will all be wrapped. Maybe it'll help. 😊

image

@machinaeZER0
Copy link
Collaborator Author

Ohh, that is useful! I'll keep that in mind for the future :) thanks Micah!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants