Slashdot Mirror


Best Weblog Application for Posting Source Code?

BrewerDude asks: "I've set up a blog about programming (URL withheld: this isn't about self-promotion). I'm currently using one of the popular blog hosting services, but find it lacking when it comes to handling source code snippets in posts. It's even worse when it comes to dealing with code snippets that people include in their comments. At this point I'm frustrated enough that I'm ready to move from that service to something else. Ideally, I'm looking for something that will handle syntax highlighting for a variety of languages and do this for both the posts and the comments. I'd prefer a hosted solution, but am not opposed to installing and maintaining my own instance of a blog application if necessary. What have you found to be the best blog application when it comes to supporting posts and comments that include source code?"

14 of 75 comments (clear)

  1. Google... by jginspace · · Score: 2, Informative

    Top result: http://www.google.com/search?q=coding+blog is powered by something I'd never heard of called Community Server http://communityserver.org/.

    I'm currently using one of the popular blog hosting services, but find it lacking when it comes to handling source code snippets in posts.

    I can see what you mean after swiftly browsing some of the other sites that came near the top of the above search... I would have thought WordPress would have a plugin though...

    1. Re:Google... by Zontar+The+Mindless · · Score: 2, Informative
      I would have thought WordPress would have a plugin though...


      Scott Reilly's Preserve Code Formatting plugin is working fine for me with WordPress 2.0.4.
      --
      Il n'y a pas de Planet B.
  2. DokuWiki by bigpresh · · Score: 5, Informative

    It's not a blog service/package per se (although there are some blogging-type plugins for it) but I find DokuWiki to be excellent at handling code snippets with decent syntax highlighting, and easy to use.

    An example bit of code can be done as easily as:

    <code perl>
    # some code here
    </code>

  3. Ikiwiki + source code coloring from Trac by halfnerd · · Score: 3, Informative

    Ikiwiki ( http://ikiwiki.kitenet.net/ ) is a really extendable wiki/blog-software and you could write a plugin in the style of Trac's Syntax Coloring support ( http://trac.edgewall.org/wiki/TracSyntaxColoring )

  4. JavaScript syntax highlighting by bigHairyDog · · Score: 3, Informative

    Dean Edwards' javascript syntax highlighter handles several languages (you can easily add your own) and operates via DHTML behaviors so you don't even need to include the script files in the page. It works in most browsers.

    http://dean.edwards.name/my/examples/star-light/

    What you need to use it is a blog that will let you post files to the server or create your own custom HTML templates, and then let people post HTML code. Code wrapped in <pre class="javascript"> gets highlighted correctly.

    If you can't post files, a bit of hacking around with the source code and you can embed it in a template and invoke it manually with javascript.

    Wordpress lets you post your own HTML templates with script - either install it on your own server or go for their free hosted service at wordpress.com.

    --

    foo mane padme hum

  5. Syntax highlighter by ricardo_nz · · Score: 3, Informative

    Not sure about a decent blog... but for highlighting code, geshi does a nice job.

  6. Copy Source as HTML by JamesNK · · Score: 2, Informative

    If you're using Visual Studio and you want your code snippits to look like they do in the IDE then I highly recommend the Copy Source as HTML plugin. It takes your code and produces a very clean HTML copy, correctly indented and colored, which you can then paste into your post.

    You can see an example of it in a blog post here.

    1. Re:Copy Source as HTML by dolmen.fr · · Score: 2, Informative

      ...unless you use:

      let use_xhtml=1
      let html_use_css=1

  7. pastecode by staalanden · · Score: 2, Informative

    I think http://pastecode.com/ is what you are looking for

  8. vim + nanoblogger by Phoe6 · · Score: 2, Informative

    Here is what I do it, using nanoblogger and using vim as my editor. I wouuld rely on vim Syntax handling ablities and covert the portion of the code into :TOHtml.

    --
    Senthil
  9. You want Drupal + appropriate filter by yelvington · · Score: 3, Informative

    Drupal and the codefilter module will do a good job of supporting basic code entry in any arbitrary language. If you want robust support for highlighting for multiple languages, take a look at GeSHIFilter.

    http://drupal.org/
    http://drupal.org/project/codefilter
    GeSHIFilter: http://drupal.org/node/65961 and demo: http://www.ubisum.com/node/27

  10. Re:You *are* a programmer by usacomp2k3 · · Score: 2, Informative

    Why reinvent the wheel if it's already available?

  11. Re:You *are* a programmer by LarsWestergren · · Score: 2, Informative

    You know, as a programmer, you could write it yourself...

    Oh, absolutely. As a programmer, I say it is his SACRED DUTY to uphold the tradition of Not Invented Here! ;-)

    --

    Being bitter is drinking poison and hoping someone else will die

  12. Emacs Muse by rpdillon · · Score: 2, Informative
    I just killed my Wordpress install over at Etherplex in favor of Emacs Muse. If you are an Emacs user already, Muse is a snap to use, and is a general document generator that can output to LaTeX, HTML, RDF, RSS and something called journal-html, which is designed specifically for blogs and is designed to be styled by a custom CSS. You can see the results over at my site.

    If you want to see the source file in emacs that generated that, check out the muse source for my site. Keep in mind that when using it in Emacs, the markup doesn't actually appear - it is converted to the proper fonts on-the-fly in Emacs.

    In this context, the use of htmlize is perfect for generating an HTML form of your code buffer from emacs. Whatever your color scheme, htmlize will pick up the colors and use them to generate the HTML. If you're not publishing an entire page, I suggest you set htmlize to use the "font" method for generating html that can be used without corresponding matching CSS. If you use Emacs color-theme package, the theme "BlippBlopp" produces good results for publishing on the web.

    The only thing this system lack that I care about is comments, but since no one reads my blog, its not that big of an issue. I installed SimpleMachine's SMF for blog comments and other forum needs. Vanilla may also be a good choice.

    Finally, it's worth mentioning that I can then edit my site from anywhere via Tramp mode in Emacs, which allows seamless file editting on remote servers over SSH. This way, I can edit my site from my laptop on the road, or my deskktop at home without worrying about having the code with me. Muse will then publish remotely as well (though there seems to be a bug with RSS generation and Tramp that I need to work out).