My favorites | Sign in
Project Logo
                
Search
for
Updated Dec 15 (5 days ago) by tre...@gmail.com
Labels: Featured
Extras  
Extras provided by markdown2.py

By default markdown2.py's processing attempts to produce output exactly as defined by http://daringfireball.net/projects/markdown/syntax -- the "Markdown core." However, a few optional extras are also provided.

Implemented Extras

  • CodeFriendly: Disable _ and __ for em and strong.
  • Footnotes: support footnotes as in use on daringfireball.net and implemented in other Markdown processors (tho not in Markdown.pl v1.0.1).
  • CodeColor: Pygments-based syntax coloring of <code> sections.
  • LinkPatterns: Auto-link given regex patterns in text (e.g. bug number references, revision number references).
  • CuddledLists: Allow lists to be cuddled to the preceding paragraph.
  • pyshell: Treats unindented Python interactive shell sessions as <code> blocks. (TODO: wiki page for this)
  • xml: Passes one-liner processing instructions and namespaced XML tags. (TODO: wiki page for this)

How to turn on extras

Extras are all off by default and turned on as follows on the command line:

python markdown2.py --extras name1,name2 ...

and via the module interface:

>>> import markdown2
>>> html = markdown2.markdown_path(path, ..., extras=["name1", "name2"])
>>> html = markdown2.markdown("some markdown", ..., extras=["name1", "name2"])

>>> markdowner = Markdown(..., extras=["name1", "name2"])
>>> markdowner.convert("*boo!*")
<em>boo!</em>

(New in v1.0.1.2) You can also now specify extras via the "markdown-extras" emacs-style local variable in the markdown text:

<!-- markdown-extras: code-friendly, footnotes -->
This markdown text will be converted with the "code-friendly" and "footnotes"
extras enabled.

or:

This markdown text will be converted with the "code-friendly" and "footnotes"
extras enabled.

<!--
  Local Variables:
  markdown-extras: code-friendly, footnotes
  End:
  -->

extras TODO


Comment by x...@xlii.org, Nov 27, 2008

Did you mean:

# -- markdown-extras: code-friendly, footnotes; --

Comment by hannson, May 22, 2009

How extension friendly is python-markdown2?

Comment by tre...@gmail.com, Oct 01, 2009

@xlii: yes, I meant something like:

<!-- -*- markdown-extras: ... -*- -->

@hannson: python-markdown2 doesn't have a real extension story. One could subclass the Markdown class to achieve a number of types of tweaks to the processing, but there aren't explicit hooks (so some tweaks might be difficult) and there isn't an internal intermediary parsed representation (as there is in the current markdown.py) on which some transformations by an extension might be convenient.

Comment by whalberg, Nov 01, 2009

Hi, i'm very new to markdown and markdown2. Where do we add that <!-- markdown-extras: code-friendly, footnotes --> line?


Sign in to add a comment
Hosted by Google Code