To install Markdown's extensions by Python

Posted by Masi on Super User See other posts from Super User or by Masi
Published on 2009-07-26T05:09:09Z Indexed on 2010/04/07 19:33 UTC
Read the original article Hit count: 684

Filed under:
|
|
|
|

The installation notes (git://gitorious.org/python-markdown/mainline.git) say in the file using_as_module.txt

One of the parameters that you can pass is a list of Extensions. Extensions must be available as python modules either within the markdown.extensions package or on your PYTHONPATH with names starting with mdx_, followed by the name of the extension. Thus, extensions=['footnotes'] will first look for the module markdown.extensions.footnotes, then a module named mdx_footnotes. See the documentation specific to the extension you are using for help in specifying configuration settings for that extension.

I put the folder "extensions" to ~/bin/python/ such that my PYTHONPATH is the following

export PYTHONPATH=/Users/masi/bin/python/:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/

The instructions say that I need to import the addons such that

import markdown
import <module-name>

However, I cannot see any module in my Python. This suggests me that the extensions are not available as "python modules - - on [my] PYTHONPATH with names starting with mdx_ - -."

How can you get Markdown's extensions to work?


2nd attempt

I run at ~/bin/markdown

git clone git://gitorious.org/python-markdown/mainline.git python-markdown
cd python-markdown
python setup.py install

I put the folder /Users/masi/bin/markdown/python-markdown/build to my PATH because the installation message suggests me that is the new location of the extensions.

I have the following in a test markdown -document

[TOC]
-- headings here with # -format ---

However, I do not get the table of contents. This suggests me that we need to somehow activate the extensions when we compile by the markdown.py -script. **The problem returns to my first quoted text which I is rather confusing to me.

© Super User or respective owner

Related posts about markdown

Related posts about modules