News for hackers. Stuff that matters.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by arb99 on Saturday May 18, 2013 @07:47AM (#5728591)
Was expecting full html markup with colours etc like in most IDEs. maybe add that as a optional feature? http://qbnz.com/highlighter/ or similar library might help there.

This seems like a slightly extended htmlentities(nl2br($input)) (if done in php). handy in those times you need stuff converted so it'll output the same way as what you are pasting in.

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by buttscicles on Saturday May 18, 2013 @08:06AM (#5728628)
Pygments (http://pygments.org/) is the best Python library for this. (op is using Django)

It's pretty configurable, and outputs something like this (both the pastebin and linked paste make use of it):

https://paste.buttscicl.es/u/877a8d68d88239985e6bb39a4ccaa81...

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by oakaz on Saturday May 18, 2013 @07:38AM (#5728571)
no colors?

I would just prefer to wrap my code with <pre></pre> instead of using a whitespace generator which makes pain in the ass to make modifications on the code.

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by sp332 on Saturday May 18, 2013 @10:02AM (#5728922)
<pre> doesn't help with HTML escaping though.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by kranner on Saturday May 18, 2013 @06:34AM (#5728458)
Great, but I'd like to see a preview of the output on that page.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by Nurdok on Saturday May 18, 2013 @06:37AM (#5728466)
What do you mean? It shows the output in the bottom text area.

Edit: you mean, show a rendering of the output in the page?

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by kranner on Saturday May 18, 2013 @06:42AM (#5728473)
That's right: I meant a rendering.

Edit: actually, never mind. The UI is fine for its intended use.

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by Nurdok on Saturday May 18, 2013 @06:50AM (#5728488)
Got a preview rendering to work. Check it out again. Thanks for the suggestion!
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by kranner on Saturday May 18, 2013 @06:53AM (#5728492)
Awesome, that's some quick turnaround!
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by kruhft on Saturday May 18, 2013 @10:00AM (#5728918)
Export your font-locked (colored) emacs buffer to html:

http://www.emacswiki.org/emacs/Htmlize

or

http://www.emacswiki.org/emacs/HtmlFontify

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by alipang on Saturday May 18, 2013 @10:34AM (#5729033)
I can definitely recommend using org-mode for tech blogging.

With the #+BEGIN_SRC tag you can automatically get an export of code set by the emacs-mode for that language, in addition to markup for other text.

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by franzwong on Saturday May 18, 2013 @11:10AM (#5729176)
I would recommend you to write a javascript version to render on the fly. So that you can keep your code being saved without any modification.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by Perrydu on Saturday May 18, 2013 @07:28AM (#5728556)
If you write blog posts in markdown, it's useless.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by jabbernotty on Saturday May 18, 2013 @08:15AM (#5728641)
It is for html. It is called Htmlify.

I don't see why you feel a need to call it useless, just because it doesn't apply to markdown.

Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by Nurdok on Saturday May 18, 2013 @07:51AM (#5728600)
I blog with tumblr (http://blog.amir.rachum.com) and HTML is the only viable option I see there. Yeah, I probably need to change my venue :) In any case, this project (as stated in the footer) is more of an experience for me. I don't expect this to revolutionize anything. Just a nice tool which I personally need.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by elliottcarlson on Saturday May 18, 2013 @08:27AM (#5728669)
You can switch to the Markdown editor on your settings page; https://www.tumblr.com/settings
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by deepdog on Saturday May 18, 2013 @09:58AM (#5728916)
You can use HTML in Markdown.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by borplk on Saturday May 18, 2013 @08:22AM (#5728657)
Does it just wrap your code in pre and code tags or am I missing something?
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by Nurdok on Saturday May 18, 2013 @08:25AM (#5728664)
It also maintains whitespaces and escapes special html symbols (&, <, >). I know it doesn't do much. As I said, it's only a convenience.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by tuananh on Saturday May 18, 2013 @09:28AM (#5728825)
this can be done easily with a script as it simply wrap the tex with a pre tag. i don't see the need for this kind of thing. tech bloggers usually got enough knowledge for this kind of stuff.
Re:Show HN: HTMLify - Turn code snippets into HTML, for tech... by Nurdok on Saturday May 18, 2013 @11:46AM (#5729276)
It also escapes html tags and such.