Command Line (000003)

To use markdown.py by itself, run it as

python markdown.py <input_file>

or

python markdown.py <input_file> > <output_file>

If you are using Python 2.3 or higher, you can also use advanced command line options to specify encoding or to run extensions.

$ python markdown.py
usage: markdown.py INPUTFILE [options]

options:
  -h, --help            show this help message and exit
  -f OUTPUT_FILE, --file=OUTPUT_FILE
                        write output to OUTPUT_FILE
  -e ENCODING, --encoding=ENCODING
                        encoding for input and output files
  -q, --quiet           suppress all messages
  -v, --verbose         print info messages
  -s, --safe            same mode (strip user's HTML tag)
  --noisy               print debug messages
  -x EXTENSION, --extension=EXTENSION
                        load extension EXTENSION

For an extension to be ran this way it must be provided in a module named mdx_{extensionname}.py which should be in your python path, e.g. mdx_footnotes.py. It can then be invoked as by name (the part after "mdx_"):

python markdown.py -x footnotes text_with_footnotes.txt output.html

If the extension supports config options (see below), you can also pass them in as well:

python markdown.py -x "footnotes(PLACE_MARKER=~~~~~~~~)"
Powered by Sputnik | XHTML 1.1