Tue Oct 28 08:00:02 EDT 2008

Nanoblogger setup notes

I have FINALLY got nanoblogger working in a way that is making sense and with wiki markup. So let me document what I've done here, because it’s a bit unstandard.

One big requirement was to be able to make entries in some kind of wiki-type markup. There’s a plugin for this in nanoblogger, but setting it up is damn confusing. The functionality comes from a script called markdown which translates wiki markup into html. The original script was implemented in Perl, however there’s also a python module by the same name and with about the same functionality. After several trials and errors, this is what I finally did that worked.

First install the python markdown module:

easy_install install markdown 

The remaining steps won’t make sense until a web log is created in nanoblogger so lets talk about that next.

I created a new weblog with

nb --blog-dir /Users/vschmidt/Sites/aliceandval.com/valswork/blog add weblog

You are asked to configure it initially. I did and here is a summary of my configuration:

# set default editor for your weblog (defaults to $EDITOR).
NB_EDITOR="$EDITOR"

# set default browser for previewing your weblog (defaults to $BROWSER)
NB_BROWSER="open"

# set the full URL to your weblog (required for absolute links).
# e.g. BLOG_URL="http://weblog.user/~foo" ("/" gets appended automatically)
BLOG_URL="/Users/vschmidt/Sites/aliceandval.com/valswork/blog"

# title of your weblog.
BLOG_TITLE="Brain Log - Think it out. Write it down."

# description of your weblog.
BLOG_DESCRIPTION="a place to capture ideas, howtos and other details related to ocean engineering and oceanography"

# contact information for your weblog.
# e.g. BLOG_CONTACT='<a href="mailto:foo@null.org">'$BLOG_AUTHOR'</a>'
BLOG_CONTACT="vschmidt@ccom.unh.edu"

# command to run when publishing your weblog to a remote site.
# used by the option and prompt for publishing (when set).
BLOG_PUBLISH_CMD="/Users/vschmidt/bin/pushweb"

# default entry text formatting (name of the text formatting plugin(s)).
# e.g. plugins/entry/format/autobr.sh = autobr
ENTRY_FORMAT="markdown"

markdown plugin configuration
MARKDOWN_CMD="python -m markdown"
MARKDOWN_OPTS="/dev/stdin"

Now with the weblog created and configured, I needed to setup the markdown plugin. I have installed nanoblogger itself in /usr/local/packages/nanoblogger, and all the default plugins exist in a plugin directory within that path. However any plugin directives placed in the local blogdir/plugins path over-ride the defaults. Although I tried and tried to get plugins/entry/format/markdown.sh (the default plugin for markdown provided by nanoblogger) to properly execute it always failed. So I wrote my own simple replacement for it (placed in /blogdir/plugins/entry/format/markdown.sh):

# A plugin for markdown. 

NB_EntryBody=$(echo "$NB_EntryBody" | $MARKDOWN_CMD $MARKDOWN_OPTS)

Here MARKDOWNCMD and MARKDOWNOPTS were defined in blog.conf and NB_EntryBody is defined by nanoblogger as the text of your entry. So far this seems to work well.


Posted by vschmidt | Permanent link | File under: nanoblogger-help