Debian Codegraph @

docs/index.md

raw
1 title: Python-Markdown
2
3 Python-Markdown
4 ===============
5
6 This is a Python implementation of John Gruber's
7 [Markdown](https://daringfireball.net/projects/markdown/).
8 It is almost completely compliant with the reference implementation,
9 though there are a few very minor [differences](#differences). See John's
10 [Syntax Documentation](https://daringfireball.net/projects/markdown/syntax)
11 for the syntax rules.
12
13 To get started, see the [installation instructions](install.md), the [library
14 reference](reference.md), and the [command line interface](cli.md).
15
16 Goals
17 -----
18
19 The Python-Markdown project is developed with the following goals in mind:
20
21 * Maintain a Python library (with an optional CLI wrapper) suited to use in web
22 server environments (never raise an exception, never write to stdout, etc.) as
23 an implementation of the markdown parser that follows the
24 [syntax rules][] and the behavior of the original (markdown.pl)
25 implementation as reasonably as possible (see [differences](#differences) for
26 a few exceptions).
27
28 * Provide an [Extension API](extensions/api.md) which makes it possible
29 to change and/or extend the behavior of the parser.
30
31 !!! Note
32
33 *This is not a CommonMark implementation*; nor is it trying to be!
34 Python-Markdown was developed long before the CommonMark specification was
35 released and has always (mostly) followed the [syntax rules][] and behavior
36 of the original reference implementation. No accommodations have been made
37 to address the changes which CommonMark has suggested. It is recommended
38 that you look elsewhere if you want an implementation which follows the
39 CommonMark specification.
40
41 Features
42 --------
43
44 In addition to the basic markdown syntax, Python-Markdown supports the following
45 features:
46
47 * __International Input__
48
49 Python-Markdown will accept [input](reference.md#text) in any language
50 supported by Unicode including bi-directional text. In fact the test suite
51 includes documents written in Russian and Arabic.
52
53 * __Extensions__
54
55 Various [extensions](extensions/index.md) are provided (including
56 [extra](extensions/extra.md)) to change and/or extend the base syntax.
57 Additionally, a public [Extension API](extensions/api.md) is available
58 to write your own extensions.
59
60 * __Output Formats__
61
62 Python-Markdown can output documents with either HTML or XHTML style tags.
63 See the [Library Reference](reference.md#output_format) for details.
64
65 * __Command Line Interface__
66
67 In addition to being a Python Library, a
68 [command line script](cli.md) is available for your convenience.
69
70 Differences
71 -----------
72
73 While Python-Markdown strives to fully implement markdown as described in the
74 [syntax rules](https://daringfireball.net/projects/markdown/syntax), the rules
75 can be interpreted in different ways and different implementations
76 occasionally vary in their behavior (see the
77 [Babelmark FAQ](https://johnmacfarlane.net/babelmark2/faq.html#what-are-some-examples-of-interesting-divergences-between-implementations)
78 for some examples). Known and intentional differences found in Python-Markdown
79 are summarized below:
80
81 * __Middle-Word Emphasis__
82
83 Python-Markdown defaults to ignoring middle-word emphasis (and strong
84 emphasis). In other words, `some_long_filename.txt` will not become
85 `some<em>long</em>filename.txt`. This can be switched off if desired. See
86 the [Legacy EM Extension](extensions/legacy_em.md) for details.
87
88 * __Indentation/Tab Length__
89
90 The [syntax rules](https://daringfireball.net/projects/markdown/syntax#list)
91 clearly state that when a list item consists of multiple paragraphs, "each
92 subsequent paragraph in a list item **must** be indented by either 4 spaces
93 or one tab" (emphasis added). However, many implementations do not enforce
94 this rule and allow less than 4 spaces of indentation. The implementers of
95 Python-Markdown consider it a bug to not enforce this rule.
96
97 This applies to any block level elements nested in a list, including
98 paragraphs, sub-lists, blockquotes, code blocks, etc. They **must** always
99 be indented by at least four spaces (or one tab) for each level of nesting.
100
101 In the event that one would prefer different behavior,
102 [tab_length](reference.md#tab_length) can be set to whatever length is
103 desired. Be warned however, as this will affect indentation for all aspects
104 of the syntax (including root level code blocks). Alternatively, a
105 [third party extension] may offer a solution that meets your needs.
106
107 * __Consecutive Lists__
108
109 While the syntax rules are not clear on this, many implementations (including
110 the original) do not end one list and start a second list when the list marker
111 (asterisks, pluses, hyphens, and numbers) changes. For consistency,
112 Python-Markdown maintains the same behavior with no plans to change in the
113 foreseeable future. That said, the [Sane List Extension](extensions/sane_lists.md)
114 is available to provide a less surprising behavior.
115
116 Support
117 -------
118
119 You may report bugs, ask for help, and discuss various other issues on the [bug tracker][].
120
121 [third party extension]: https://github.com/Python-Markdown/markdown/wiki/Third-Party-Extensions
122 [syntax rules]: https://daringfireball.net/projects/markdown/syntax
123 [bug tracker]: https://github.com/Python-Markdown/markdown/issues