Blogging and formatted code

I’d like to hear from anyone who is happy with their blogging engine’s treatment of code. I use Blogger, and it strips leading spaces from each line of my code on every edit/preview pass. I lose alignment, and eventually, all the code ends up at the left margin.

7 Comments

  1. Porges:

    For my occasional posts (under WordPress), I use the WP-Syntax plugin… and a bit of LatexRender :)

  2. Neil Mitchell:

    I use Blogger in HTML edit mode, and use “pre” tags to include the code. It works fine, as long as you are used to HTML.

  3. Josef:

    The method I currently use for posting code on Blogger is to write my posts using literate Haskell. Then I feed it through HsColor which will make it look pretty and does all the right tagging for me. I then submit the HTML to Blogger.

  4. Ivan Tarasov:

    I’m thinking now of creating a plugin for TiddlyWiki which would allow to post any tiddler (its formatted contents, actually to the blog which supports some specific API (I need at least MetaWeblog API and LiveJournal API for my blogs). Still, I’m not sure what do I need to do to have a nice syntax coloring/formatting of the code embedded in tiddlers.

  5. Conal:

    ivan — i’d be very interested in a tiddlywiki->blog converter, so please let me know if you work on it. maybe i could help, though i don’t know anything about these APIs.

    i do have some nice tools for formatting haskell code in tiddlers. see my online journal for plugins and sample uses.

    i’ve been looking for collaboration in some fun Haskell+TiddlyWiki ideas. i’m imagining TW-based browsing of collections of Haskell source code. syntax-colored, fully hyperlinked to definitions & docs, and comments with formatting & images. possibilities abound. interested?

  6. Ivan Tarasov:

    Conal, I’ve seen your TW journal couple of months ago and I must say that it is awesome!

    The APIs are quite simple, they are based on XML-RPC requests to the server. The good news is that the XML-RPC implementation is available in Firefox, so there’s no need to implement that part. The bad news is the support of other browsers, although I’m fine having only Firefox supported.

    To post to a blog using any of these API one needs only to instantiate the XML-RPC connector, set the connection parameters and then just call some remote method using XML-RPC, passing the blog post contents and other information (e.g. tags) in the parameters.

    I think it should be possible to add a button “post to blog” for the tiddlers with some tag (like “post-to:blog-id”), but I still don’t know a lot about internals of TW to understand how to do that, neither I don’t know how to extract the formatted HTML of the tiddler contents.

    Another idea for syntax coloring is to use the highlight.js. Although it doesn’t have Haskell syntax coloring, it shouldn’t be hard to implement it.

    It’s a bit hard to track the comments here, should you have any ideas, just send me a note to Ivan.Tarasov@gmail.com.

  7. iblog:

    may be this can help

    http://formatmysourcecode.blogspot.com/

    http://hype-free.blogspot.com/2006/12/how-to-publish-good-looking-code-on.html

Leave a comment