@@ -15,58 +15,58 @@ Python-Markdown version 2.6 supports Python versions 2.7, 3.2, 3.3, and 3.4.
15
15
Backwards-incompatible Changes
16
16
------------------------------
17
17
18
- * Both `safe_mode` and the associated `html_replacement_text` keywords are deprecated
19
- in version 2.6 and will raise a **`DeprecationWarning`**. The `safe_mode` and
20
- `html_replacement_text` keywords will be ignored in version 2.7. The so-called
21
- "safe mode" was never actually "safe" which has resulted in many people having a false
22
- sense of security when using it. As an alternative, the developers of Python-Markdown
23
- recommend that any untrusted content be passed through an HTML sanitizer (like [Bleach])
24
- after being converted to HTML by markdown.
18
+ * Both `safe_mode` and the associated `html_replacement_text` keywords are deprecated
19
+ in version 2.6 and will raise a **`DeprecationWarning`**. The `safe_mode` and
20
+ `html_replacement_text` keywords will be ignored in version 2.7. The so-called
21
+ "safe mode" was never actually "safe" which has resulted in many people having a false
22
+ sense of security when using it. As an alternative, the developers of Python-Markdown
23
+ recommend that any untrusted content be passed through an HTML sanitizer (like [Bleach])
24
+ after being converted to HTML by markdown.
25
25
26
26
If your code previously looked like this:
27
27
28
- html = markdown.markdown(text, safe_mode=True)
28
+ html = markdown.markdown(text, safe_mode=True)
29
29
30
- Then it is recommended that you change your code to read something like this:
30
+ Then it is recommended that you change your code to read something like this:
31
31
32
- import bleach
32
+ import bleach
33
33
html = bleach.clean(markdown.markdown(text))
34
34
35
- If you are not interested in sanitizing untrusted text, but simply desire to escape
36
- raw HTML, then that can be accomplished through an extension which removes HTML parsing:
35
+ If you are not interested in sanitizing untrusted text, but simply desire to escape
36
+ raw HTML, then that can be accomplished through an extension which removes HTML parsing:
37
37
38
- from markdown.extensions import Extension
38
+ from markdown.extensions import Extension
39
39
40
- class EscapeHtml(Extension):
41
- def extendMarkdown(self, md, md_globals):
42
- del md.preprocessors['html_block']
43
- del md.inlinePatterns['html']
40
+ class EscapeHtml(Extension):
41
+ def extendMarkdown(self, md, md_globals):
42
+ del md.preprocessors['html_block']
43
+ del md.inlinePatterns['html']
44
44
45
- html = markdown.markdown(text, extensions=[EscapeHtml()])
45
+ html = markdown.markdown(text, extensions=[EscapeHtml()])
46
46
47
- As the HTML would not be parsed with the above Extension, then the searializer will
48
- escape the raw HTML, which is exactly what happens now when `safe_mode="escape"`.
47
+ As the HTML would not be parsed with the above Extension, then the searializer will
48
+ escape the raw HTML, which is exactly what happens now when `safe_mode="escape"`.
49
49
50
50
[Bleach]: http://bleach.readthedocs.org/
51
51
52
- * Positional arguments on the `markdown.Markdown()` are deprecated as are
53
- all except the `text` argument on the `markdown.markdown()` wrapper function.
54
- Using positional argument will raise a **`DeprecationWarning`** in 2.6 and an error
55
- in version 2.7. Only keyword arguments should be used. For example, if your code
56
- previosuly looked like this:
52
+ * Positional arguments on the `markdown.Markdown()` class are deprecated as are
53
+ all except the `text` argument on the `markdown.markdown()` wrapper function.
54
+ Using positional arguments will raise a **`DeprecationWarning`** in 2.6 and an error
55
+ in version 2.7. Only keyword arguments should be used. For example, if your code
56
+ previosuly looked like this:
57
57
58
- html = markdown.markdown(text, ['extra' ])
58
+ html = markdown.markdown(text, [SomeExtension() ])
59
59
60
- Then it is recommended that you change it to read something like this:
60
+ Then it is recommended that you change it to read something like this:
61
61
62
- html = markdown.markdown(text, extensions=['extra' ])
62
+ html = markdown.markdown(text, extensions=[SomeExtension() ])
63
63
64
- !!! Note
65
- This change is being made as a result of deprecating `"safe_mode"` as the
66
- `safe_mode` argumnet was one of the positional arguments. When that argument
67
- is removed, the two arguments following it will no longer be at the correct
68
- position. It is recomended that you always use keywords when they are supported
69
- for this reason.
64
+ !!! Note
65
+ This change is being made as a result of deprecating `"safe_mode"` as the
66
+ `safe_mode` argument was one of the positional arguments. When that argument
67
+ is removed, the two arguments following it will no longer be at the correct
68
+ position. It is recomended that you always use keywords when they are supported
69
+ for this reason.
70
70
71
71
* In previous versions of Python-Markdown, the builtin extensions received
72
72
special status and did not require the full path to be provided. Additionaly,
@@ -80,7 +80,7 @@ Backwards-incompatible Changes
80
80
81
81
You should change your code to the following:
82
82
83
- markdown.markdown(text, extensions=['markdown.extensions.extra'])
83
+ markdown.markdown(text, extensions=['markdown.extensions.extra'])
84
84
85
85
The same applies to the command line:
86
86
@@ -89,12 +89,12 @@ Backwards-incompatible Changes
89
89
See the [documentation](reference.html#extensions) for a full explaination
90
90
of the current behavior.
91
91
92
- * The previously documented method of appending the extension configs as
93
- a string to the extension name is deprecated and will raise a
94
- **`DeprecationWarning`** in version 2.6 and an error in 2.7.
95
- The [extension_configs](reference.html#extension_configs) keyword should
96
- be used instead. See the [documentation](reference.html#extension-configs)
97
- for a full explaination of the current behavior.
92
+ * The previously documented method of appending the extension configs as
93
+ a string to the extension name is deprecated and will raise a
94
+ **`DeprecationWarning`** in version 2.6 and an error in 2.7.
95
+ The [extension_configs](reference.html#extension_configs) keyword should
96
+ be used instead. See the [documentation](reference.html#extension-configs)
97
+ for a full explaination of the current behavior.
98
98
99
99
* The [HeaderId][hid] Extension is pending deprecation and will raise a
100
100
**`PendingDeprecationWarning`** in version 2.6. The extension will be
@@ -107,7 +107,7 @@ Backwards-incompatible Changes
107
107
defined in the Table of Contents extension and should adjust their import
108
108
statements accordingly (`from markdown.extensions.toc import slugify, unique`).
109
109
110
- [hid]: extensions/headerid .html
110
+ [hid]: extensions/header_id .html
111
111
112
112
What's New in Python-Markdown 2.6
113
113
---------------------------------
@@ -129,16 +129,16 @@ What's New in Python-Markdown 2.6
129
129
130
130
* The extension now assigns the Table of Contents to the `toc` attribute of
131
131
the Markdown class regardless of whether a "marker" was found in the document.
132
- Third party frameworks no longer need to insert a "marker," run the document
133
- through Markdown, then extract the TOC from the document.
132
+ Third party frameworks no longer need to insert a "marker," run the document
133
+ through Markdown, then extract the TOC from the document.
134
134
135
135
* The TOC Extension is now a "registered extension." Therefore, when the `reset`
136
136
method of the Markdown class is called, the `toc` attribute on the Markdown
137
- class is cleared (set to an empty string).
137
+ class is cleared (set to an empty string).
138
138
139
139
* When the `marker` config option is set to an empty string, the parser completely
140
140
skips the process of searching the document for markers. This should save parsing
141
- time when the TOC Extension is being used only to assign ids to headers.
141
+ time when the TOC Extension is being used only to assign ids to headers.
142
142
143
143
* A `separator` config option has been added allowing users to override the
144
144
separator character used by the slugify function.
@@ -153,7 +153,7 @@ What's New in Python-Markdown 2.6
153
153
will not directly effect end users, the code is being better tested which will
154
154
benefit everyone.
155
155
156
- [fake8 ]: http://flake8.readthedocs.org/en/latest/
156
+ [flake8 ]: http://flake8.readthedocs.org/en/latest/
157
157
158
158
* Various bug fixes have been made. See the
159
159
[commit log](https://github.com/waylan/Python-Markdown/commits/master)
0 commit comments