Commit 6405f2f3 authored by gijs's avatar gijs

Migration to new python markdown 3

parent 9533ad84
...@@ -180,11 +180,11 @@ class PageAdmin(admin.ModelAdmin): ...@@ -180,11 +180,11 @@ class PageAdmin(admin.ModelAdmin):
}), }),
('Dutch', { ('Dutch', {
'classes': (), 'classes': (),
'fields': ('title', 'menu_label', 'content') 'fields': ('title', 'content')
}), }),
('English', { ('English', {
'classes': (), 'classes': (),
'fields': ('title_en', 'menu_label_en', 'content_en') 'fields': ('title_en', 'content_en')
}) })
) )
......
...@@ -69,7 +69,7 @@ def markdown_filter(value): ...@@ -69,7 +69,7 @@ def markdown_filter(value):
extensions = ["extra", ] extensions = ["extra", ]
return mark_safe(markdown.markdown(force_text(value), return mark_safe(markdown.markdown(force_text(value),
extensions)) extensions=extensions))
p_surrounds = re.compile(r'<p>(.*)</p>') p_surrounds = re.compile(r'<p>(.*)</p>')
......
...@@ -13,6 +13,8 @@ import os ...@@ -13,6 +13,8 @@ import os
# PyPi imports # PyPi imports
import markdown import markdown
from markdown.extensions.toc import TocExtension
from py_etherpad import EtherpadLiteClient from py_etherpad import EtherpadLiteClient
import dateutil.parser import dateutil.parser
import pytz import pytz
...@@ -306,7 +308,7 @@ def pad_read(request, mode="r", slug=None): ...@@ -306,7 +308,7 @@ def pad_read(request, mode="r", slug=None):
# we don’t want Etherpads automatically generated HTML, we want plain text. # we don’t want Etherpads automatically generated HTML, we want plain text.
text = epclient.getText(padID)['text'] text = epclient.getText(padID)['text']
if extension in ['.md', '.markdown']: if extension in ['.md', '.markdown']:
md = markdown.Markdown(extensions=['extra', 'meta', 'headerid(level=2)', 'attr_list', 'figcaption']) md = markdown.Markdown(extensions=['extra', 'meta', TocExtension(baselevel=2), 'attr_list', 'figcaption'])
text = md.convert(text) text = md.convert(text)
try: try:
meta = md.Meta meta = md.Meta
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment