Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: How to format code while commenting on HN?
1 point by suyash on April 12, 2013 | hide | past | favorite | 2 comments
I've seen some people use code blocks to format text so it's more readable on HN? How do you do that?

Thanks.



The FAQ is linked at the bottom of the page:

http://ycombinator.com/newsfaq.html

In there it says:

What kind of formatting can you use in comments?

http://news.ycombinator.com/formatdoc

On that page it says:

    Blank lines separate paragraphs.

    Text after a blank line that is indented by two or
    more spaces is reproduced verbatim. (This is intended
    for code.)

    Text surrounded by asterisks is italicized, if the
    character after the first asterisk isn't whitespace.

    Urls become links, except in the text field of a
    submission.


You prefix it with 4 spaces.

    # like this




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

Search: