Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 2.92 KB

README.md

File metadata and controls

69 lines (46 loc) · 2.92 KB

Markdown Subscript

Build Status Coverage Status PyPI Version License

An extension to Waylan Limberg's Python Markdown project (documentation here) that provides support for subscript text in Markdown. The extension treats ~ characters as tags, converting pairs into HTML sub tags.

Given the text:

The molecular composition of water is H~2~O.

… using Markdown with this extension will output:

<p>The molecular composition of water is H<sub>2</sub>O.</p>

This project is provided under the Simplified (2 Clause) BSD license, provided in full in the LICENSE file.

Installation

Dependencies:

  • Python 2.6, 2.7, 3.2+
  • Markdown 2.4+ (Tested against 2.4.1, 2.5.1)

To install the latest stable release (recommended):

$ pip install MarkdownSubscript

To install the development version:

$ pip install git+git://github.com/jambonrose/markdown_subscript_extension.git

Basic Usage

Python

>>> from markdown import markdown
>>> text = "The molecular composition of water is H~2~O."
>>> markdown(text, ['subscript'])
'<p>The molecular composition of water is H<sub>2</sub>O.</p>'

Command Line

$ echo 'The molecular composition of water is H~2~O.' > text.md
$ python -m markdown -o html5 -x 'subscript' -f text.html text.md

Development

Development requires the installation of Python and Pip. A virtual environment, such as virtualenvwrapper (used in the example below), is recommended. Once these are installed, the following steps may be taken:

$ git clone https://github.com/jambonrose/markdown_subscript_extension.git
$ cd markdown_subscript_extension/
$ mkvirtualenv markdown_subcript  # recommended, but optional
$ cat requirements/* > requirements.txt
$ pip install -r requirements.txt

The Makefile provides the ability to run tests by invoking $ make test, which will invoke the nose package with the command $ nosetests --with-coverage --cover-package=mdx_subscript (incidentally, this is also the command used on TravisCI and Coveralls.io).