From 31ea829c686f6ed4cca5258967c0a30077f933f6 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 21 Aug 2014 11:11:40 -0400 Subject: Standardized all extension header comments to a uniform format. --- markdown/extensions/abbr.py | 25 +++--- markdown/extensions/admonition.py | 35 ++------- markdown/extensions/attr_list.py | 11 ++- markdown/extensions/codehilite.py | 13 ++-- markdown/extensions/def_list.py | 15 ++-- markdown/extensions/extra.py | 11 ++- markdown/extensions/fenced_code.py | 88 ++-------------------- markdown/extensions/footnotes.py | 32 +++----- markdown/extensions/headerid.py | 75 ++---------------- markdown/extensions/meta.py | 40 ++-------- markdown/extensions/nl2br.py | 14 ++-- markdown/extensions/sane_lists.py | 15 ++-- markdown/extensions/smart_strong.py | 23 ++---- markdown/extensions/smarty.py | 146 ++++++++++++++++++++---------------- markdown/extensions/tables.py | 13 ++-- markdown/extensions/toc.py | 12 ++- markdown/extensions/wikilinks.py | 71 ++---------------- 17 files changed, 193 insertions(+), 446 deletions(-) diff --git a/markdown/extensions/abbr.py b/markdown/extensions/abbr.py index 7f2344a..58dd0aa 100644 --- a/markdown/extensions/abbr.py +++ b/markdown/extensions/abbr.py @@ -4,22 +4,15 @@ Abbreviation Extension for Python-Markdown This extension adds abbreviation handling to Python-Markdown. -Simple Usage: - - >>> import markdown - >>> text = """ - ... Some text with an ABBR and a REF. Ignore REFERENCE and ref. - ... - ... *[ABBR]: Abbreviation - ... *[REF]: Abbreviation Reference - ... """ - >>> print(markdown.markdown(text, ['abbr'])) -

Some text with an ABBR and a REF. Ignore REFERENCE and ref.

- -Copyright 2007-2008 -* [Waylan Limberg](http://achinghead.com/) -* [Seemant Kulleen](http://www.kulleen.org/) - +See +for documentation. + +Oringinal code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/) and + [Seemant Kulleen](http://www.kulleen.org/) + +All changes Copyright 2008-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) ''' diff --git a/markdown/extensions/admonition.py b/markdown/extensions/admonition.py index 7888d5e..189f2c2 100644 --- a/markdown/extensions/admonition.py +++ b/markdown/extensions/admonition.py @@ -4,39 +4,16 @@ Admonition extension for Python-Markdown Adds rST-style admonitions. Inspired by [rST][] feature with the same name. -The syntax is (followed by an indented block with the contents): - !!! [type] [optional explicit title] - -Where `type` is used as a CSS class name of the div. If not present, `title` -defaults to the capitalized `type`, so "note" -> "Note". - -rST suggests the following `types`, but you're free to use whatever you want: - attention, caution, danger, error, hint, important, note, tip, warning - - -A simple example: - !!! note - This is the first line inside the box. - -Outputs: -
-

Note

-

This is the first line inside the box

-
+[rST]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions -You can also specify the title and CSS class of the admonition: - !!! custom "Did you know?" - Another line here. +See +for documentation. -Outputs: -
-

Did you know?

-

Another line here.

-
+Original code Copyright [Tiago Serafim](http://www.tiagoserafim.com/). -[rST]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions +All changes Copyright The Python Markdown Project -By [Tiago Serafim](http://www.tiagoserafim.com/). +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py index 55b2f1f..59da3b4 100644 --- a/markdown/extensions/attr_list.py +++ b/markdown/extensions/attr_list.py @@ -6,15 +6,14 @@ Adds attribute list syntax. Inspired by [maruku](http://maruku.rubyforge.org/proposal.html#attribute_lists)'s feature of the same name. -Copyright 2011 [Waylan Limberg](http://achinghead.com/). +See +for documentation. -Contact: markdown@freewisdom.org +Original code Copyright 2011 [Waylan Limberg](http://achinghead.com/). -License: BSD (see ../LICENSE.md for details) +All changes Copyright 2011-2014 The Python Markdown Project -Dependencies: -* [Python 2.4+](http://python.org) -* [Markdown 2.1+](https://pythonhosted.org/Markdown/) +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py index 6336cfc..7fbf83f 100644 --- a/markdown/extensions/codehilite.py +++ b/markdown/extensions/codehilite.py @@ -4,17 +4,14 @@ CodeHilite Extension for Python-Markdown Adds code/syntax highlighting to standard Python-Markdown code blocks. -Copyright 2006-2008 [Waylan Limberg](http://achinghead.com/). +See +for documentation. -Project website: -Contact: markdown@freewisdom.org +Original code Copyright 2006-2008 [Waylan Limberg](http://achinghead.com/). -License: BSD (see ../LICENSE.md for details) +All changes Copyright 2008-2014 The Python Markdown Project -Dependencies: -* [Python 2.3+](http://python.org/) -* [Markdown 2.0+](https://pythonhosted.org/Markdown/) -* [Pygments](http://pygments.org/) +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/def_list.py b/markdown/extensions/def_list.py index 3511651..22e2491 100644 --- a/markdown/extensions/def_list.py +++ b/markdown/extensions/def_list.py @@ -2,19 +2,16 @@ Definition List Extension for Python-Markdown ============================================= -Added parsing of Definition Lists to Python-Markdown. +Adds parsing of Definition Lists to Python-Markdown. -A simple example: +See +for documentation. - Apple - : Pomaceous fruit of plants of the genus Malus in - the family Rosaceae. - : An american computer company. +Original code Copyright 2008 [Waylan Limberg](http://achinghead.com) - Orange - : The fruit of an evergreen tree of the genus Citrus. +All changes Copyright 2008-2014 The Python Markdown Project -Copyright 2008 - [Waylan Limberg](http://achinghead.com) +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/extra.py b/markdown/extensions/extra.py index 6fba8db..c5526d1 100644 --- a/markdown/extensions/extra.py +++ b/markdown/extensions/extra.py @@ -11,10 +11,6 @@ convenience so that only one extension needs to be listed when initiating Markdown. See the documentation for each individual extension for specifics about that extension. -In the event that one or more of the supported extensions are not -available for import, Markdown will issue a warning and simply continue -without that extension. - There may be additional extensions that are distributed with Python-Markdown that are not included here in Extra. Those extensions are not part of PHP Markdown Extra, and therefore, not part of @@ -24,6 +20,13 @@ under a differant name. You could also edit the `extensions` global variable defined below, but be aware that such changes may be lost when you upgrade to any future version of Python-Markdown. +See +for documentation. + +Copyright The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) + """ from __future__ import absolute_import diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py index 4403ccd..2aacca6 100644 --- a/markdown/extensions/fenced_code.py +++ b/markdown/extensions/fenced_code.py @@ -4,87 +4,15 @@ Fenced Code Extension for Python Markdown This extension adds Fenced Code Blocks to Python-Markdown. - >>> import markdown - >>> text = ''' - ... A paragraph before a fenced code block: - ... - ... ~~~ - ... Fenced code block - ... ~~~ - ... ''' - >>> html = markdown.markdown(text, extensions=['fenced_code']) - >>> print(html) -

A paragraph before a fenced code block:

-
Fenced code block
-    
- -Works with safe_mode also (we check this because we are using the HtmlStash): - - >>> print(markdown.markdown(text, extensions=['fenced_code'], safe_mode='replace')) -

A paragraph before a fenced code block:

-
Fenced code block
-    
- -Include tilde's in a code block and wrap with blank lines: - - >>> text = ''' - ... ~~~~~~~~ - ... - ... ~~~~ - ... ~~~~~~~~''' - >>> print(markdown.markdown(text, extensions=['fenced_code'])) -

-    ~~~~
-    
- -Language tags: - - >>> text = ''' - ... ~~~~{.python} - ... # Some python code - ... ~~~~''' - >>> print(markdown.markdown(text, extensions=['fenced_code'])) -
# Some python code
-    
- -Optionally backticks instead of tildes as per how github's code block markdown is identified: - - >>> text = ''' - ... ````` - ... # Arbitrary code - ... ~~~~~ # these tildes will not close the block - ... `````''' - >>> print(markdown.markdown(text, extensions=['fenced_code'])) -
# Arbitrary code
-    ~~~~~ # these tildes will not close the block
-    
- -If the codehighlite extension and Pygments are installed, lines can be highlighted: - - >>> text = ''' - ... ```hl_lines="1 3" - ... line 1 - ... line 2 - ... line 3 - ... ```''' - >>> print(markdown.markdown(text, extensions=['codehilite', 'fenced_code'])) -
line 1
-    line 2
-    line 3
-    
- -Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/). - -Project website: -Contact: markdown@freewisdom.org - -License: BSD (see ../docs/LICENSE for details) - -Dependencies: -* [Python 2.4+](http://python.org) -* [Markdown 2.0+](https://pythonhosted.org/Markdown/) -* [Pygments (optional)](http://pygments.org) +See +for documentation. +Original code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/). + + +All changes Copyright 2008-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ from __future__ import absolute_import diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py index cec0d71..a59de97 100644 --- a/markdown/extensions/footnotes.py +++ b/markdown/extensions/footnotes.py @@ -1,25 +1,15 @@ """ -========================= FOOTNOTES ================================= - -This section adds footnote handling to markdown. It can be used as -an example for extending python-markdown with relatively complex -functionality. While in this case the extension is included inside -the module itself, it could just as easily be added from outside the -module. Not that all markdown classes above are ignorant about -footnotes. All footnote functionality is provided separately and -then added to the markdown instance at the run time. - -Footnote functionality is attached by calling extendMarkdown() -method of FootnoteExtension. The method also registers the -extension to allow it's state to be reset by a call to reset() -method. - -Example: - Footnotes[^1] have a label[^label] and a definition[^!DEF]. - - [^1]: This is a footnote - [^label]: A footnote on "label" - [^!DEF]: The footnote for definition +Footnotes Extension for Python-Markdown +======================================= + +Adds footnote handling to Python-Markdown. + +See +for documentation. + +Copyright The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/headerid.py b/markdown/extensions/headerid.py index f96f239..5ae84f3 100644 --- a/markdown/extensions/headerid.py +++ b/markdown/extensions/headerid.py @@ -4,73 +4,14 @@ HeaderID Extension for Python-Markdown Auto-generate id attributes for HTML headers. -Basic usage: - - >>> import markdown - >>> text = "# Some Header #" - >>> md = markdown.markdown(text, ['headerid']) - >>> print(md) -

Some Header

- -All header IDs are unique: - - >>> text = ''' - ... #Header - ... #Header - ... #Header''' - >>> md = markdown.markdown(text, ['headerid']) - >>> print(md) -

Header

-

Header

-

Header

- -To fit within a html template's hierarchy, set the header base level: - - >>> text = ''' - ... #Some Header - ... ## Next Level''' - >>> md = markdown.markdown(text, ['headerid(level=3)']) - >>> print(md) -

Some Header

-

Next Level

- -Works with inline markup. - - >>> text = '#Some *Header* with [markup](http://example.com).' - >>> md = markdown.markdown(text, ['headerid']) - >>> print(md) -

Some Header with markup.

- -Turn off auto generated IDs: - - >>> text = ''' - ... # Some Header - ... # Another Header''' - >>> md = markdown.markdown(text, ['headerid(forceid=False)']) - >>> print(md) -

Some Header

-

Another Header

- -Use with MetaData extension: - - >>> text = '''header_level: 2 - ... header_forceid: Off - ... - ... # A Header''' - >>> md = markdown.markdown(text, ['headerid', 'meta']) - >>> print(md) -

A Header

- -Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/). - -Project website: -Contact: markdown@freewisdom.org - -License: BSD (see ../docs/LICENSE for details) - -Dependencies: -* [Python 2.3+](http://python.org) -* [Markdown 2.0+](https://pythonhosted.org/Markdown/) +See +for documentation. + +Original code Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/). + +All changes Copyright 2011-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/meta.py b/markdown/extensions/meta.py index 3d89946..bb81a86 100644 --- a/markdown/extensions/meta.py +++ b/markdown/extensions/meta.py @@ -4,38 +4,14 @@ Meta Data Extension for Python-Markdown This extension adds Meta Data handling to markdown. -Basic Usage: - - >>> import markdown - >>> text = '''Title: A Test Doc. - ... Author: Waylan Limberg - ... John Doe - ... Blank_Data: - ... - ... The body. This is paragraph one. - ... ''' - >>> md = markdown.Markdown(['meta']) - >>> print(md.convert(text)) -

The body. This is paragraph one.

- >>> print(md.Meta) # doctest: +SKIP - {'blank_data': [''], 'author': ['Waylan Limberg', 'John Doe'], 'title': ['A Test Doc.']} - -Make sure text without Meta Data still works (markdown < 1.6b returns a

). - - >>> text = ' Some Code - not extra lines of meta data.' - >>> md = markdown.Markdown(['meta']) - >>> print(md.convert(text)) -

Some Code - not extra lines of meta data.
-    
- >>> md.Meta - {} - -Copyright 2007-2008 [Waylan Limberg](http://achinghead.com). - -Project website: -Contact: markdown@freewisdom.org - -License: BSD (see ../LICENSE.md for details) +See +for documentation. + +Original code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com). + +All changes Copyright 2008-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/nl2br.py b/markdown/extensions/nl2br.py index eab4084..062a7e6 100644 --- a/markdown/extensions/nl2br.py +++ b/markdown/extensions/nl2br.py @@ -5,18 +5,14 @@ NL2BR Extension A Python-Markdown extension to treat newlines as hard breaks; like GitHub-flavored Markdown does. -Usage: +See +for documentation. - >>> import markdown - >>> print(markdown.markdown('line 1\\nline 2', extensions=['nl2br'])) -

line 1
- line 2

+Oringinal code Copyright 2011 [Brian Neal](http://deathofagremmie.com/) -Copyright 2011 [Brian Neal](http://deathofagremmie.com/) +All changes Copyright 2011-2014 The Python Markdown Project -Dependencies: -* [Python 2.4+](http://python.org) -* [Markdown 2.1+](https://pythonhosted.org/Markdown/) +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/sane_lists.py b/markdown/extensions/sane_lists.py index 22a4ff3..9eb3a11 100644 --- a/markdown/extensions/sane_lists.py +++ b/markdown/extensions/sane_lists.py @@ -2,19 +2,16 @@ Sane List Extension for Python-Markdown ======================================= -Modify the behavior of Lists in Python-Markdown t act in a sane manor. +Modify the behavior of Lists in Python-Markdown to act in a sane manor. -In standard Markdown syntax, the following would constitute a single -ordered list. However, with this extension, the output would include -two lists, the first an ordered list and the second and unordered list. +See +for documentation. - 1. ordered - 2. list +Original code Copyright 2011 [Waylan Limberg](http://achinghead.com) - * unordered - * list +All changes Copyright 2011-2014 The Python Markdown Project -Copyright 2011 - [Waylan Limberg](http://achinghead.com) +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/smart_strong.py b/markdown/extensions/smart_strong.py index 877b5a7..331dae8 100644 --- a/markdown/extensions/smart_strong.py +++ b/markdown/extensions/smart_strong.py @@ -4,21 +4,14 @@ Smart_Strong Extension for Python-Markdown This extention adds smarter handling of double underscores within words. -Simple Usage: - - >>> import markdown - >>> print(markdown.markdown('Text with double__underscore__words.', - ... extensions=['smart_strong'])) -

Text with double__underscore__words.

- >>> print(markdown.markdown('__Strong__ still works.', - ... extensions=['smart_strong'])) -

Strong still works.

- >>> print(markdown.markdown('__this__works__too__.', - ... extensions=['smart_strong'])) -

this__works__too.

- -Copyright 2011 -[Waylan Limberg](http://achinghead.com) +See +for documentation. + +Original code Copyright 2011 [Waylan Limberg](http://achinghead.com) + +All changes Copyright 2011-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) ''' diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py index d5ac62c..00c330f 100644 --- a/markdown/extensions/smarty.py +++ b/markdown/extensions/smarty.py @@ -1,69 +1,85 @@ # -*- coding: utf-8 -*- -# Smarty extension for Python-Markdown -# Author: 2013, Dmitry Shachnev - -# SmartyPants license: -# -# Copyright (c) 2003 John Gruber -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# * Neither the name "SmartyPants" nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -# This software is provided by the copyright holders and contributors "as -# is" and any express or implied warranties, including, but not limited -# to, the implied warranties of merchantability and fitness for a -# particular purpose are disclaimed. In no event shall the copyright -# owner or contributors be liable for any direct, indirect, incidental, -# special, exemplary, or consequential damages (including, but not -# limited to, procurement of substitute goods or services; loss of use, -# data, or profits; or business interruption) however caused and on any -# theory of liability, whether in contract, strict liability, or tort -# (including negligence or otherwise) arising in any way out of the use -# of this software, even if advised of the possibility of such damage. -# -# -# smartypants.py license: -# -# smartypants.py is a derivative work of SmartyPants. -# Copyright (c) 2004, 2007 Chad Miller -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# This software is provided by the copyright holders and contributors "as -# is" and any express or implied warranties, including, but not limited -# to, the implied warranties of merchantability and fitness for a -# particular purpose are disclaimed. In no event shall the copyright -# owner or contributors be liable for any direct, indirect, incidental, -# special, exemplary, or consequential damages (including, but not -# limited to, procurement of substitute goods or services; loss of use, -# data, or profits; or business interruption) however caused and on any -# theory of liability, whether in contract, strict liability, or tort -# (including negligence or otherwise) arising in any way out of the use -# of this software, even if advised of the possibility of such damage. +''' +Smarty extension for Python-Markdown +==================================== + +Adds conversion of ASCII dashes, quotes and ellipses to their HTML +entity equivalents. + +See +for documentation. + +Author: 2013, Dmitry Shachnev + +All changes Copyright 2013-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) + +SmartyPants license: + + Copyright (c) 2003 John Gruber + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name "SmartyPants" nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + This software is provided by the copyright holders and contributors "as + is" and any express or implied warranties, including, but not limited + to, the implied warranties of merchantability and fitness for a + particular purpose are disclaimed. In no event shall the copyright + owner or contributors be liable for any direct, indirect, incidental, + special, exemplary, or consequential damages (including, but not + limited to, procurement of substitute goods or services; loss of use, + data, or profits; or business interruption) however caused and on any + theory of liability, whether in contract, strict liability, or tort + (including negligence or otherwise) arising in any way out of the use + of this software, even if advised of the possibility of such damage. + + +smartypants.py license: + + smartypants.py is a derivative work of SmartyPants. + Copyright (c) 2004, 2007 Chad Miller + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + This software is provided by the copyright holders and contributors "as + is" and any express or implied warranties, including, but not limited + to, the implied warranties of merchantability and fitness for a + particular purpose are disclaimed. In no event shall the copyright + owner or contributors be liable for any direct, indirect, incidental, + special, exemplary, or consequential damages (including, but not + limited to, procurement of substitute goods or services; loss of use, + data, or profits; or business interruption) however caused and on any + theory of liability, whether in contract, strict liability, or tort + (including negligence or otherwise) arising in any way out of the use + of this software, even if advised of the possibility of such damage. + +''' + from __future__ import unicode_literals from . import Extension diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index 2977bd1..57507e9 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -4,14 +4,15 @@ Tables Extension for Python-Markdown Added parsing of tables to Python-Markdown. -A simple example: +See +for documentation. - First Header | Second Header - ------------- | ------------- - Content Cell | Content Cell - Content Cell | Content Cell +Original code Copyright 2009 [Waylan Limberg](http://achinghead.com) + +All changes Copyright 2008-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) -Copyright 2009 - [Waylan Limberg](http://achinghead.com) """ from __future__ import absolute_import diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py index 8ab8c03..22cf063 100644 --- a/markdown/extensions/toc.py +++ b/markdown/extensions/toc.py @@ -1,11 +1,15 @@ """ Table of Contents Extension for Python-Markdown -* * * +=============================================== -(c) 2008 [Jack Miller](http://codezen.org) +See +for documentation. -Dependencies: -* [Markdown 2.1+](https://pythonhosted.org/Markdown/) +Oringinal code Copyright 2008 [Jack Miller](http://codezen.org) + +All changes Copyright 2008-2014 The Python Markdown Project + +License: [BSD](http://www.opensource.org/licenses/bsd-license.php) """ diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py index cb20906..64377cf 100644 --- a/markdown/extensions/wikilinks.py +++ b/markdown/extensions/wikilinks.py @@ -2,78 +2,17 @@ WikiLinks Extension for Python-Markdown ====================================== -Converts [[WikiLinks]] to relative links. Requires Python-Markdown 2.0+ +Converts [[WikiLinks]] to relative links. -Basic usage: +See +for documentation. - >>> import markdown - >>> text = "Some text with a [[WikiLink]]." - >>> html = markdown.markdown(text, ['wikilinks']) - >>> print(html) -

Some text with a WikiLink.

+Original code Copyright [Waylan Limberg](http://achinghead.com/). -Whitespace behavior: - - >>> print(markdown.markdown('[[ foo bar_baz ]]', ['wikilinks'])) -

foo bar_baz

- >>> print(markdown.markdown('foo [[ ]] bar', ['wikilinks'])) -

foo bar

- -To define custom settings the simple way: - - >>> print(markdown.markdown(text, - ... ['wikilinks(base_url=/wiki/,end_url=.html,html_class=foo)'] - ... )) -

Some text with a WikiLink.

- -Custom settings the complex way: - - >>> md = markdown.Markdown( - ... extensions = ['wikilinks'], - ... extension_configs = {'wikilinks': [ - ... ('base_url', 'http://example.com/'), - ... ('end_url', '.html'), - ... ('html_class', '') ]}, - ... safe_mode = True) - >>> print(md.convert(text)) -

Some text with a WikiLink.

- -Use MetaData with mdx_meta.py (Note the blank html_class in MetaData): - - >>> text = """wiki_base_url: http://example.com/ - ... wiki_end_url: .html - ... wiki_html_class: - ... - ... Some text with a [[WikiLink]].""" - >>> md = markdown.Markdown(extensions=['meta', 'wikilinks']) - >>> print(md.convert(text)) -

Some text with a WikiLink.

- -MetaData should not carry over to next document: - - >>> print(md.convert("No [[MetaData]] here.")) -

No MetaData here.

- -Define a custom URL builder: - - >>> def my_url_builder(label, base, end): - ... return '/bar/' - >>> md = markdown.Markdown(extensions=['wikilinks'], - ... extension_configs={'wikilinks' : [('build_url', my_url_builder)]}) - >>> print(md.convert('[[foo]]')) -

foo

- -From the command line: - - python markdown.py -x wikilinks(base_url=http://example.com/,end_url=.html,html_class=foo) src.txt - -By [Waylan Limberg](http://achinghead.com/). +All changes Copyright The Python Markdown Project License: [BSD](http://www.opensource.org/licenses/bsd-license.php) -Dependencies: -* [Python 2.3+](http://python.org) -* [Markdown 2.0+](https://pythonhosted.org/Markdown/) ''' from __future__ import absolute_import -- cgit v1.2.3