Trent Mick: May 2010

June Vancouver Python User Group (VanPyZ) this Tuesday at ActiveState

We are hosting the June VanPyZ meeting at ActiveState this coming Tuesday evening. Come see Andy Mckay talk about Using SMS in the Developing World and chat about Python. Festivities begin at 7pm here.

More details on my work blog post and at vanpyz.org.

0 comments

python-markdown2 1.0.1.17

Where?

What's new?

  • [Issue 36] Fix "cuddled-lists" extra handling for an looks-like-a-cuddled-list-but-is-indented block. See the "test/tm-cases/cuddledlistindented.text" test case.

  • Experimental new "toc" extra. The returned string from conversion will have a toc_html attribute.

  • New "header-ids" extra that will add an id attribute to headers:

    # My First Section
    

    will become:

    <h1 id="my-first-section">My First Section</h1>
    

    An argument can be give for the extra, which will be used as a prefix for the ids:

    $ cat foo.txt 
    # hi there
    $ python markdown2.py foo.txt 
    <h1>hi there</h1>
    $ python markdown2.py foo.txt -x header-ids
    <h1 id="hi-there">hi there</h1>
    $ python markdown2.py foo.txt -x header-ids=prefix
    <h1 id="prefix-hi-there">hi there</h1>
    
  • Preliminary support for "html-classes" extra: takes a dict mapping HTML tag to the string value to use for a "class" attribute for that emitted tag. Currently just supports "pre" and "code" for code blocks.

Full changelog: http://code.google.com/p/python-markdown2/source/browse/trunk/CHANGES.txt

What is 'markdown2'?

markdown2.py is a fast and complete Python implementation of Markdown -- a text-to-HTML markup syntax.

Module usage

>>> 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'

Command line usage

$ cat hi.markdown
# Hello World!
$ markdown2 hi.markdown
<h1>Hello World!</h1>

This implementation of Markdown implements the full "core" syntax plus a number of extras (e.g., code syntax coloring, footnotes) as described on http://code.google.com/p/python-markdown2/wiki/Extras.

1 comments

eol.py -- a tool for working with text file end-of-line characters

Just finally released eol.py (on github, on pypi) -- a tool I've been using for a while to help find and convert EOLs in text files. It is a small Python module and command-line script. MIT license. Hopefully useful to others.

See the notes in either link above for usage details.

0 comments