/usr/share/doc/python-markdown-doc/docs/cli.html is in python-markdown-doc 2.6.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | <!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Command Line — Python Markdown</title>
<link rel="stylesheet" href="default.css" type="text/css">
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="siteindex.html" title="General Index">index</a></li>
<li class="right">
<a href="extensions/index.html" title="Extensions"
accesskey="N">next</a> |</li>
<li class="right">
<a href="reference.html" title="Library Reference"
accesskey="P">previous</a> |</li>
<li><img src="py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="index.html">Python Markdown v2.6.8 documentation</a> »</li>
<li><a href="cli.html">Command Line</a> »</li>
</ul>
</div> <!-- .related -->
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1 id="using-python-markdown-on-the-command-line">Using Python-Markdown on the Command Line<a class="headerlink" href="#using-python-markdown-on-the-command-line" title="Permanent link">¶</a></h1>
<p>While Python-Markdown is primarily a python library, a command line script is
included as well. While there are many other command line implementations
of Markdown, you may not have them installed, or you may prefer to use
Python-Markdown’s various extensions.</p>
<p>Generally, you will want to have the Markdown library fully installed on your
system to run the command line script. See the
<a href="install.html">Installation instructions</a> for details.</p>
<p>Python-Markdown’s command line script takes advantage of Python’s <code>-m</code> flag.
Therefore, assuming the python executable is on your system path, use the
following format:</p>
<pre><code>$ python -m markdown [options] [args]
</code></pre>
<p>That will run the module as a script with the options and arguments provided. </p>
<p>At its most basic usage, one would simply pass in a file name as the only argument:</p>
<pre><code>$ python -m markdown input_file.txt
</code></pre>
<p>Piping input and output (on <code>STDIN</code> and <code>STDOUT</code>) is fully supported as well.
For example:</p>
<pre><code>$ echo "Some **Markdown** text." | python -m markdown > output.html
</code></pre>
<p>Use the <code>--help</code> option for a list all available options and arguments:</p>
<pre><code>$ python -m markdown --help
</code></pre>
<p>If you don’t want to call the python executable directly (using the <code>-m</code> flag),
follow the instructions below to use a wrapper script:</p>
<h2 id="setup">Setup<a class="headerlink" href="#setup" title="Permanent link">¶</a></h2>
<p>Upon installation, the <code>markdown_py</code> script will have been copied to
your Python “Scripts” directory. Different systems require different methods to
ensure that any files in the Python “Scripts” directory are on your system
path.</p>
<ul>
<li>
<p><strong>Windows</strong>:</p>
<p>Assuming a default install of Python on Windows, your “Scripts” directory
is most likely something like <code>C:\\Python26\Scripts</code>. Verify the location
of your “Scripts” directory and add it to you system path.</p>
<p>Calling <code>markdown_py</code> from the command line will call the wrapper batch
file <code>markdown_py.bat</code> in the <code>"Scripts"</code> directory created during install.</p>
</li>
<li>
<p><strong>*nix</strong> (Linux, OSX, BSD, Unix, etc.):</p>
<p>As each *nix distribution is different and we can’t possibly document all
of them here, we’ll provide a few helpful pointers:</p>
<ul>
<li>
<p>Some systems will automatically install the script on your path. Try it
and see if it works. Just run <code>markdown_py</code> from the command line.</p>
</li>
<li>
<p>Other systems may maintain a separate “Scripts” (“bin”) directory which
you need to add to your path. Find it (check with your distribution) and
either add it to your path or make a symbolic link to it from your path.</p>
</li>
<li>
<p>If you are sure <code>markdown_py</code> is on your path, but it still is not being
found, check the permissions of the file and make sure it is executable.</p>
</li>
</ul>
<p>As an alternative, you could just <code>cd</code> into the directory which contains
the source distribution, and run it from there. However, remember that your
markdown text files will not likely be in that directory, so it is much
more convenient to have <code>markdown_py</code> on your path.</p>
</li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Python-Markdown uses <code>"markdown_py"</code> as a script name because
the Perl implementation has already taken the more obvious name “markdown”.
Additionally, the default Python configuration on some systems would cause a
script named <code>"markdown.py"</code> to fail by importing itself rather than the markdown
library. Therefore, the script has been named <code>"markdown_py"</code> as a compromise. If
you prefer a different name for the script on your system, it is suggested that
you create a symbolic link to <code>markdown_py</code> with your preferred name.</p>
</div>
<h2 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">¶</a></h2>
<p>To use <code>markdown_py</code> from the command line, run it as </p>
<pre><code>$ markdown_py input_file.txt
</code></pre>
<p>or </p>
<pre><code>$ markdown_py input_file.txt > output_file.html
</code></pre>
<p>For a complete list of options, run</p>
<pre><code>$ markdown_py --help
</code></pre>
<h2 id="using-extensions">Using Extensions<a class="headerlink" href="#using-extensions" title="Permanent link">¶</a></h2>
<p>To load a Python-Markdown extension from the command line use the <code>-x</code>
(or <code>--extension</code>) option. The extension module must be on your <code>PYTHONPATH</code>
(see the <a href="extensions/api.html">Extension API</a> for details). The extension can
then be invoked by the name of that module using Python’s dot syntax:</p>
<pre><code>$ python -m markdown -x path.to.module input.txt
</code></pre>
<p>To load multiple extensions, specify an <code>-x</code> option for each extension:</p>
<pre><code>$ python -m markdown -x markdown.extensions.footnotes -x markdown.extensions.codehilite input.txt
</code></pre>
<p>If the extension supports configuration options (see the documentation for the
extension you are using to determine what settings it supports, if any), you
can pass them in as well:</p>
<pre><code>$ python -m markdown -x markdown.extensions.footnotes -c config.yml input.txt
</code></pre>
<p>The <code>-c</code> (or <code>--extension_configs</code>) option accepts a file name. The file must be in
either the <a href="http://yaml.org/">YAML</a> or <a href="http://json.org/">JSON</a> format and contain YAML or JSON data that would map to
a Python Dictionary in the format required by the <a href="reference.html#extension_configs"><code>extension_configs</code></a> keyword
of the <code>markdown.Markdown</code> class. Therefore, the file <code>config.yaml</code> referenced in the
above example might look like this:</p>
<pre><code>markdown.extensions.footnotes:
PLACE_MARKER: ~~~~~~~~
UNIQUE_IDS: True
</code></pre>
<p>Note that while the <code>--extension_configs</code> option does specify the “markdown.extensions.footnotes”
extension, you still need to load the extension with the <code>-x</code> option, or the configuration for that
extension will be ignored.</p>
<p>The <code>--extension_configs</code> option will only support YAML configuration files if <a href="http://pyyaml.org/">PyYAML</a> is
installed on your system. JSON should work with no additional dependencies. The format
of your configuration file is automatically detected.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>The previously documented method of appending the extension configuration options as a string to the
extension name will be deprecated in Python-Markdown version 2.6. The <code>--extension_configs</code>
option should be used instead. See the <a href="release-2.5.txt">2.5 release notes</a> for more information.</p>
</div>
</div> <!-- .body -->
</div> <!-- .bodywrapper -->
</div> <!-- .documentwrapper -->
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3>Table Of Contents</h3>
<div class="toc">
<ul>
<li><a href="#using-python-markdown-on-the-command-line">Using Python-Markdown on the Command Line</a><ul>
<li><a href="#setup">Setup</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#using-extensions">Using Extensions</a></li>
</ul>
</li>
</ul>
</div>
<h4>Previous topic</h4>
<p class="topless"><a href="reference.html"
title="previous chapter">Library Reference</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="extensions/index.html"
title="next chapter">Extensions</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="https://github.com/waylan/Python-Markdown/issues"
>Report a Bug</a></li>
<li><a href="cli.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div> <!-- .sphinxsidebarwrapper -->
</div> <!-- .sphinxsidebar -->
<div class="clearer"></div>
</div> <!-- .document -->
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="siteindex.html" title="General Index">index</a></li>
<li class="right">
<a href="extensions/index.html" title="Extensions"
accesskey="N">next</a> |</li>
<li class="right">
<a href="reference.html" title="Library Reference"
accesskey="P">previous</a> |</li>
<li><img src="py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="index.html">Python Markdown v2.6.8 documentation</a> »</li>
<li><a href="cli.html">Command Line</a> »</li>
</ul>
</div> <!-- .related -->
<div class="footer">© 2010-2012 Python Markdown Project</div>
</body>
</html>
|