Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the "town hall" (meta-discussion site) for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Comments on Code blocks need to be at least 80 characters wide

Post

Code blocks need to be at least 80 characters wide

+1
−0

80 characters is a standard width in programming, so lots of code is written to that size, e.g. Python and Shell according to Google's style guides.

However, Codidact code blocks are only about 72 characters wide. Here's a screenshot of a line of 73 characters that overflows:

screenshot of overflowing code in a post

This is inconvenient for coders, so it would be good to show more characters per line, whether that's by A) widening a post body or B) shrinking the font in a code block. It looks like CSS font-size: smaller; or font-size: small; would work for this, though these have subtly different meanings.

As a workaround, I've written a userstyle:

pre {
  font-size: smaller;
}

Here's what it looks like now:

screenshot of smaller code in a post so it no longer overflows

History

2 comment threads

Another way to add a few characters of width (3 comments)
This is screen and zoom dependent - the linked post fits fine on the screen I'm using right now. In m... (4 comments)
This is screen and zoom dependent - the linked post fits fine on the screen I'm using right now. In m...
Moshi‭ wrote about 2 months ago

This is screen and zoom dependent - the linked post fits fine on the screen I'm using right now. In my opinion, changing the font size isn't really a solution either since that leads to legibility issues (We can leave that choice to the user, who can zoom out if necessary.)

wjandrea‭ wrote about 2 months ago

Moshi‭ It doesn't seem to be zoom-dependent on my system - the same amount of text overflows; the only difference is that the scroll bar stays the same size, which is only a nominal difference. I'm also not sure why it would be screen-dependent, since the one I'm using now has plenty of space; maybe it's actually that you're seeing a narrower font. Could you post a screenshot of what it looks like normally and zoomed in/out?

wjandrea‭ wrote about 2 months ago

Moshi‭ The smaller font seems perfectly legible to me, but I have 20/20 vision so I'm not one to talk :p

Moshi‭ wrote about 2 months ago · edited about 2 months ago