python-markdown2 /

Filename Size Date modified Message
bin
externals
lib
perf
sandbox
test
7.7 KB
114 B
2.2 KB
315 B
23.9 KB
2.4 KB
3.4 KB
1.9 KB

markdown2 README

This is a fast and complete Python implementation of Markdown, a text-to-html markup system as defined here:

http://daringfireball.net/projects/markdown/syntax

Install

To install it in your Python installation run:

python setup.py install

However, everything you need to run this is in "lib/markdown2.py". If it is easier for you, you can just copy that file to somewhere on your PythonPath (to use as a module) or executable path (to use as a script).

Quick Usage

As a module:

>>> import markdown2
>>> markdown2.markdown("*boo!*")  # or use `html = markdown_path(PATH)`
u'<p><em>boo!</em></p>\n'
>>> markdowner = Markdown()
>>> markdowner.convert("*boo!*")
u'<p><em>boo!</em></p>\n'
>>> markdowner.convert("**boom!**")
u'<p><strong>boom!</strong></p>\n'

As a script:

$ python markdown2.py foo.txt > foo.html

See the project pages, "lib/markdown2.py" docstrings and/or python markdown2.py --help for more details.

Project

The python-markdown2 project lives here (subversion repo, issue tracker, wiki):

http://code.google.com/p/python-markdown2/

To checkout the full sources:

svn checkout http://python-markdown2.googlecode.com/svn/trunk/ python-markdown2

To report a bug:

http://code.google.com/p/python-markdown2/issues/list

License

This project is licensed under the MIT License.

Note that in the subversion repository there are a few files (for the test suite and performance metrics) that are under different licenses. These files are not included in source packages. See LICENSE.txt for details.

Test Suite

This markdown implementation passes a fairly extensive test suite. To run it:

cd test && python test.py

If you have the [mk](http://svn.openkomodo.com/openkomodo/browse/mk/trunk) tool installed you can run the test suite with all available Python versions by running:

mk test

The crux of the test suite is a number of "cases" directories -- each with a set of matching .text (input) and .html (expected output) files. These are:

tm-cases/ Tests authored for python-markdown2 markdowntest-cases/ Tests from the 3rd-party MarkdownTest package php-markdown-cases/ Tests from the 3rd-party MDTest package php-markdown-extra-cases/ Tests also from MDTest package

See the wiki page for full details: http://code.google.com/p/python-markdown2/wiki/TestingNotes

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.