Live data from Hacker News

I spent some time exploring how to improve the UX of code blocks on the web

ped.ro

11–20 of 68 posts

Re: I spent some time exploring how to improve the UX of code blocks on the web

#11
post #3

Earlier quoted context omitted.

I agree, I like to see where I'm going

great idea! implemented, and updated the article. thank you.

It's also not easy to quickly identify it's a link, as the word highlight is the same as the previous examples.

Maybe adding an underlines or something to make it slightly different might help with that.

Re: I spent some time exploring how to improve the UX of code blocks on the web

#12

Earlier quoted context omitted.

great idea! implemented, and updated the article. thank you.

It's also not easy to quickly identify it's a link, as the word highlight is the same as the previous examples. Maybe adding an underlines or something to make it slightly different might help with that.

Right, or a small "outgoing link" symbol (usually a box with an arrow coming out the top-right corner) next to it.

Re: I spent some time exploring how to improve the UX of code blocks on the web

#13

Does anyone know if there's a trick to avoid the trailing newline when double-clicking a line to copy/paste it elsewhere? This always annoys me for single-line commands. I'd love a CSS solution but can only think of some ugly JS approaches.

I hate that too, and it seems to be a very common default behaviour of text selection. Even Vim does it when you copy a whole line.

It's one of those little UI annoyances that refuse to disappear. Just like blinking cursors in unfocused input fields & windows.

Re: I spent some time exploring how to improve the UX of code blocks on the web

#14
Viewer attention is increasingly limited these days, so avoiding small mistakes which limit your audience is recommended.

Dark mode content such as TFA is practically unreadable outside in bright light. Your reader will need to remember to return to your page some other time when they can see it, but chances are they will not return.

Re: I spent some time exploring how to improve the UX of code blocks on the web

#16

Does anyone know if there's a trick to avoid the trailing newline when double-clicking a line to copy/paste it elsewhere? This always annoys me for single-line commands. I'd love a CSS solution but can only think of some ugly JS approaches.

I hate that too, and it seems to be a very common default behaviour of text selection. Even Vim does it when you copy a whole line. It's one of those little UI annoyances that refuse to disappear. Just like blinking cursors in unfocused input fields & windows.

It probably ties into the whole “line ending not newline” philosophy of requiring files to end with an EOL character.

Re: I spent some time exploring how to improve the UX of code blocks on the web

#17
It's looks great.

I think for me biggest problem with code snippets is that I encounter them with mobile device. Lines are quite long, like who uses 80 character line limits these days, more like 160. This combined with reality that most websites don't allow mobile device to zoom out.

I wish I could read full lines of code instead of trying to scroll back and forth.

Re: I spent some time exploring how to improve the UX of code blocks on the web

#18

It's looks great. I think for me biggest problem with code snippets is that I encounter them with mobile device. Lines are quite long, like who uses 80 character line limits these days, more like 160. This combined with reality that most websites don't allow mobile device to zoom out. I wish I could read full lines of code instead of trying to scroll back and forth.

I use 80 character limits, and suggest corrections to that effect during code reviews. I feel it helps readability.

Is it becoming a tend to have longer limits?

Re: I spent some time exploring how to improve the UX of code blocks on the web

#19
post #3

Earlier quoted context omitted.

I agree, I like to see where I'm going

great idea! implemented, and updated the article. thank you.

It might also be worth having those links opening in new tabs as an option. Right now, at least on iOS, following a link and then going back leaves you at the top of the original page again, not where you were up to before you clicked the link.
Post reply on HN