

Show HN: HTMLify - Turn code snippets into HTML, for tech bloggers - Nurdok
http://www.htmlify.net/

======
arb99
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.

~~~
buttscicles
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...](https://paste.buttscicl.es/u/877a8d68d88239985e6bb39a4ccaa818/)

------
oakaz
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.

~~~
sp332
<pre> doesn't help with HTML escaping though.

------
kranner
Great, but I'd like to see a preview of the output on that page.

~~~
Nurdok
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?

~~~
kranner
That's right: I meant a rendering.

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

~~~
Nurdok
Got a preview rendering to work. Check it out again. Thanks for the
suggestion!

~~~
kranner
Awesome, that's some quick turnaround!

------
kruhft
Export your font-locked (colored) emacs buffer to html:

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

or

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

~~~
alipang
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.

------
franzwong
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.

------
Perrydu
If you write blog posts in markdown, it's useless.

~~~
Nurdok
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.

~~~
elliottcarlson
You can switch to the Markdown editor on your settings page;
<https://www.tumblr.com/settings>

------
borplk
Does it just wrap your code in pre and code tags or am I missing something?

~~~
Nurdok
It also maintains whitespaces and escapes special html symbols (&, <, >). I
know it doesn't do much. As I said, it's only a convenience.

------
tuananh
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.

~~~
Nurdok
It also escapes html tags and such.

