3 markdown-plugin.py -- A Python Markdown v2.x plugin for PyBlosxom.
5 This plugin requires Python Markdown v2.x, which you can download from:
7 http://www.freewisdom.org/projects/python-markdown/
9 Extract the 'markdown' directory from the Python Markdown tarball (the
10 directory containing __init__.py, not the Markdown-2.x.y directory) into your
11 pyblosxom plugins dir alongside this plugin. Your plugins dir should look like
14 plugins/ <-- your pyblosxom plugins dir
15 markdown-plugin.py <-- this file
16 markdown/ <-- the Python Markdown module
17 ... <-- (any other pyblosxom plugins)
19 Now any posts with filenames ending in one of the FILENAME_EXTENSIONS defined
20 below will be passed through python-markdown.
22 Copyright (C) 2005, 2011 Benjamin Mako Hill
23 Copyright (c) 2009, 2010, seanh
25 This program is free software: you can redistribute it and/or modify
26 it under the terms of the GNU General Public License as published by
27 the Free Software Foundation, either version 3 of the License, or (at
28 your option) any later version.
32 __author__ = 'Benjamin Mako Hill <mako@atdot.cc>'
33 __author__ = 'seanh <snhmnd@gmail.com>'
35 FILENAME_EXTENSIONS = ('.mdwn', '.txt','.text','.mkdn','.markdown','.md','.mdown','.markdn','.mkd')
40 md = markdown.Markdown(output_format='html4',extensions=['extra',])
44 if os.path.splitext(entry['filename'])[1] in FILENAME_EXTENSIONS:
45 entry['body'] = md.convert(u''.join(entry['body'].decode("utf-8")))