Hacker News new | past | comments | ask | show | jobs | submit login

Why did you format the code snippets in your comment in a monospace font?

Also, I'm curious. I want to see how the code looks like. I want to know what are the downsides of monospace and the benefits of proportional. The one you cited isn't too much of a deal, since it is just a habit you can create using monospace still.




> Why did you format the code snippets in your comment in a monospace font?

Because I don't know of a way to get HN to format text in a proportional font without losing the line breaks. Believe me, I've tried. :-)

> Also, I'm curious. I want to see how the code looks like.

I am glad you are curious about it!

> I want to know what are the downsides of monospace and the benefits of proportional. The one you cited isn't too much of a deal, since it is just a habit you can create using monospace still.

Indeed, and now that you mention it, I'm not entirely sure which happened first. I may have switched to the second style with indentation instead of column alignment before I started using a proportional font, just because I was tired of the excessive line lengths and always having to fiddle with the spaces.

Regarding the downsides and benefits, will it sound like a cop-out if I say it's just something you have to try for yourself?

Part of my preference for proportional fonts isn't even tied to any rational reasons. I spend much of my day looking at code, and I just find proportional fonts easier to read, more beautiful and pleasant to look at. But beauty, of course, is in the eye of the beholder.


Well at least for yourself you could adjust code blocks with Stylish [1] and some custom css.

[1]: https://userstyles.org/


Might be easier to just go with screenshots


HN is a web page, and HTML swallows multiple-spaces into a single space.


Let me test                 something.

Edit: crap, doesn't work


Unicode has some wonky characters - I use zero-width space, probably the most ridiculous of them to bypass filters at times. For intentionally wide spaces you have a few options:

Test unicode non-breaking space.

Test                                                                    unicode  narrow no break space.

Test                            unicode figure space.

EDIT: So there you have it, if you want a non-breaking space on hackernews, use unicode's figure space or narrow non-breaking space. Apparently they already filter out the normal non-breaking space.


Please don't do this. It's unreadably broken on mobile Chrome (turns into a gigantically wide space).


I'm pretty sure that if HN allowed you to do what you just tried, it would be a XSS vulnerability. :P


Nah, you can do it on Reddit because they use Markdown instead of HN's homegrown comment formatter. In case you ever need to post a proportional font code sample over there, the trick is to use   for all the leading spaces, and also add two regular spaces at the end of each line before the last one.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: