8000 Update markdown preprocessor registration (#6722) · coderanger/django-rest-framework@3e210ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e210ae

Browse files
authored
Update markdown preprocessor registration (encode#6722)
1 parent 6aac9d2 commit 3e210ae

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

docs/community/release-notes.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,26 @@ You can determine your currently installed version using `pip show`:
3838

3939
---
4040

41+
## 3.10.x series
42+
43+
### 3.10.0
44+
45+
**Date**: [Unreleased][3.10.0-milestone]
46+
47+
* Resolve DeprecationWarning with markdown. [#6317][gh6317]
48+
49+
4150
## 3.9.x series
4251

4352
### 3.9.4
4453

45-
**Date**: [10th May 2019]
54+
**Date**: 10th May 2019
4655

4756
This is a maintenance release that fixes an error handling bug under Python 2.
4857

4958
### 3.9.3
5059

51-
**Date**: [29th April 2019]
60+
**Date**: 29th April 2019
5261

5362
This is the last Django REST Framework release that will support Python 2.
5463
Be sure to upgrade to Python 3 before upgrading to Django REST Framework 3.10.
@@ -58,7 +67,7 @@ Be sure to upgrade to Python 3 before upgrading to Django REST Framework 3.10.
5867

5968
### 3.9.2
6069

61-
**Date**: [3rd March 2019][3.9.1-milestone]
70+
**Date**: [3rd March 2019][3.9.2-milestone]
6271

6372
* Routers: invalidate `_urls` cache on `register()` [#6407][gh6407]
6473
* Deferred schema renderer creation to avoid requiring pyyaml. [#6416][gh6416]
@@ -1181,7 +1190,8 @@ For older release notes, [please see the version 2.x documentation][old-release-
11811190
[3.8.2-milestone]: https://github.com/encode/django-rest-framework/milestone/68?closed=1
11821191
[3.9.0-milestone]: https://github.com/encode/django-rest-framework/milestone/66?closed=1
11831192
[3.9.1-milestone]: https://github.com/encode/django-rest-framework/milestone/70?closed=1
1184-
[3.9.1-milestone]: https://github.com/encode/django-rest-framework/milestone/71?closed=1
1193+
[3.9.2-milestone]: https://github.com/encode/django-rest-framework/milestone/71?closed=1
1194+
[3.10.0-milestone]: https://github.com/encode/django-rest-framework/milestone/69?closed=1
11851195

11861196
<!-- 3.0.1 -->
11871197
[gh2013]: https://github.com/encode/django-rest-framework/issues/2013
@@ -2125,3 +2135,6 @@ For older release notes, [please see the version 2.x documentation][old-release-
21252135

21262136
<!-- 3.9.3 -->
21272137
[gh6613]: https://github.com/encode/django-rest-framework/issues/6613
2138+
2139+
<!-- 3.10.0 -->
2140+
[gh6317]: https://github.com/encode/django-rest-framework/issues/6317

docs/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ each Python and Django series.
9393
The following packages are optional:
9494

9595
* [coreapi][coreapi] (1.32.0+) - Schema generation support.
96-
* [Markdown][markdown] (2.6.0+) - Markdown support for the browsable API.
96+
* [Markdown][markdown] (3.0.0+) - Markdown support for the browsable API.
97+
* [Pygments][pygments] (2.4.0+) - Add sytax highlighting to Markdown processing.
9798
* [django-filter][django-filter] (1.0.1+) - Filtering support.
9899
* [django-guardian][django-guardian] (1.1.1+) - Object level permissions support.
99100

@@ -237,6 +238,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
237238
[eventbrite]: https://www.eventbrite.co.uk/about/
238239
[coreapi]: https://pypi.org/project/coreapi/
239240
[markdown]: https://pypi.org/project/Markdown/
241+
[pygments]: https://pypi.org/project/Pygments/
240242
[django-filter]: https://pypi.org/project/django-filter/
241243
[django-guardian]: https://github.com/django-guardian/django-guardian
242244
[index]: .

requirements/requirements-optionals.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Optional packages which may be used with REST framework.
22
psycopg2-binary>=2.8.2, <2.9
3-
markdown==2.6.11
3+
markdown==3.1.1
4+
pygments==2.4.2
45
django-guardian==1.5.0
56
django-filter>=2.1.0, <2.2
67
coreapi==2.3.1

rest_framework/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def distinct(queryset, base):
128128
View.http_method_names = View.http_method_names + ['patch']
129129

130130

131-
# Markdown is optional (version 2.6+ required)
131+
# Markdown is optional (version 3.0+ required)
132132
try:
133133
import markdown
134134

@@ -206,7 +206,7 @@ def repl(m):
206206
return ret.split("\n")
207207

208208
def md_filter_add_syntax_highlight(md):
209-< 4ECA /span>
md.preprocessors.add('highlight', CodeBlockPreprocessor(), "_begin")
209+
md.preprocessors.register(CodeBlockPreprocessor(), 'highlight', 40)
210210
return True
211211
else:
212212
def md_filter_add_syntax_highlight(md):

0 commit comments

Comments
 (0)
0