News for hackers. Stuff that matters.

Ask HN - Why doesn't HN have code snippets in comments?

I see users paste code and error logs all the time, and it really doesn't look very good. Perhaps a real code snippet needs to be added? After all, this site is built for hackers.

Also, I'm not even talking about syntax highlighting--though that would be a plus--just basic formatting.

Thoughts?

( 6 comments | 4 points | on HN )
Re:Ask HN - Why doesn't HN have code snippets in comments? by Luyt on Saturday August 31, 2013 @12:35PM (#6307216)
Begin lines with spaces to indicate code:

  def luyt():
      return "Hello, Luyt"

  if main:
      print luyt()
Easy does it ;-)
Re:Ask HN - Why doesn't HN have code snippets in comments? by film42 on Saturday August 31, 2013 @01:34PM (#6307414)
It's not seperated from the text at all. I feel that if it looked nicer (like GitHub in that they seperate it out) would be more pleasant to share and review code. Maybe I'm just asking for too much, tho.
Re:Ask HN - Why doesn't HN have code snippets in comments? by declandewet on Saturday August 31, 2013 @01:40PM (#6307441)
Remember that any websites styles are easily overwritten with a browser extension, GreaseMonkey/TamperMonkey user script or Stylish stylesheet, and the chances of someone already having written one are fairly good. If not, create your own. :)
Re:Ask HN - Why doesn't HN have code snippets in comments? by film42 on Wednesday September 04, 2013 @03:18PM (#6329769)
Not a bad idea! I also wish HN was community developed, it would be awesome if I could submit a pull request to add better code blocks in comments.
Re:Ask HN - Why doesn't HN have code snippets in comments? by Luyt on Sunday September 08, 2013 @03:52PM (#6350026)
PRE-formatted code fragments show up in monospaced font in my browser, which makes it stand out sufficiently against the body text, which is a proportional font.
Re:Ask HN - Why doesn't HN have code snippets in comments? by pearjuice on Saturday August 31, 2013 @02:44PM (#6307678)
This is not a community where code snippets are shared frequently. If you feel the need to do so, just link to a gist or pastebin URL if you want pretty formatting..