Settings

Theme

Responsive Text and Code

unsung.aresluna.org

3 points by srijan4 · 1 comment

Reader

1 thread
WCSTombs

This came up before (same topic, different article): https://mostlyobvio.us/2026/02/responsive-code-formatting/

I'll also paraphrase what I said then: I like the idea in principle, but there's a fundamental problem that makes me think it would be really difficult to use on my website. The problem is that code autoformatters typically work great in like 90% of cases, but the last 10%, they make worse. In "real" code, the programmer can often opt out of autoformatting in problematic cases by adding special comments in the code, but that's a non-starter for code samples on my site because it would look tacky.

So what I actually do is manually format my code and break lines at about 64 characters. This doesn't completely solve horizontal scrolling, but hopefully it's good enough.

That's not to say I would never use this idea. There's a threshold of "good enough" where it could become worth it even if occasional workarounds are needed.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection