Skip to content

Commit

Permalink
move markdown2.py to a lib subdir: clearer and helpful for svn:extern…
Browse files Browse the repository at this point in the history
…als usage
  • Loading branch information
trentm committed Sep 9, 2008
1 parent e9ce022 commit eb1cca9
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 6 deletions.
94 changes: 94 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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 source repository there are a few files (for the test suite
and performance metrics) that are under different licenses. None of these
files are included in the source packages. These exceptions are as follows:

- perf/recipes.pprint: Python License

This file includes a number of real-world examples of Markdown from the
ActiveState Python Cookbook, used for doing some performance testing of
markdown2.py

- test/php-markdown-cases/* & test/php-markdown-extra-cases/*

These are copies of the MarkdownTest-1.0 and MDTest packages announced on
the markdown-discuss list.

- test/markdown.py: GPL 2 or BSD

A copy (currently old) of Python-Markdown -- the other Python Markdown
implementation.

- test/markdown.php: BSD-style

This is PHP Markdown (http://michelf.com/projects/php-markdown/).

- test/Markdown.pl: BSD-style

A copy of Perl Markdown (http://daringfireball.net/projects/markdown/).

1 change: 1 addition & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- http://support.googlecode.com/svn/trunk/scripts/googlecode_distutils_upload.py
- Extras.wiki desc of code-color option. Not sure I love the ":::name"
markup for the lexer name.
- update MDTest tests from http://git.michelf.com/mdtest/
- find more unicode edge cases (look for any usage of md5() and make that
unicode)
- update MDTest 1.1? (see
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion perf/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@



[Python Cookbook]: http://aspn.activestate.com/ASPN/Python/Cookbook/
[Python Cookbook]: http://code.activestate.com/recipes/
4 changes: 2 additions & 2 deletions perf/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Example:
python gen_perf_cases.py # generate a couple cases dirs
python perf.py all tmp-test-cases
python perf.py tmp-test-cases
"""

import os
Expand Down Expand Up @@ -52,7 +52,7 @@ def hotshot_markdown2_py(cases_dir, repeat):
time_markdown2_py(cases_dir, repeat)

def time_markdown2_py(cases_dir, repeat):
sys.path.insert(0, "..")
sys.path.insert(0, "../lib")
import markdown2
del sys.path[0]
markdowner = markdown2.Markdown()
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

""markdown2: A fast and complete Python implementaion of Markdown.
"""markdown2: A fast and complete Python implementaion of Markdown.
Markdown is a text-to-HTML filter; it translates an easy-to-read /
easy-to-write structured text format into HTML. Markdown's text
Expand All @@ -12,7 +12,10 @@
spec.
"""

import sys
from distutils.core import setup

sys.path.insert(0, "lib")
import markdown2


Expand Down
7 changes: 5 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
}

def setup():
externals_dir = join(dirname(dirname(abspath(__file__))), "externals")
pygments_dir = join(externals_dir, "pygments")
top_dir = dirname(dirname(abspath(__file__)))
lib_dir = join(top_dir, "lib")
sys.path.insert(0, lib_dir)

pygments_dir = join(top_dir, "externals", "pygments")
if exists(pygments_dir):
sys.path.insert(0, pygments_dir)

Expand Down

0 comments on commit eb1cca9

Please sign in to comment.