Commit 3b28c59a authored by Patrik Dufresne's avatar Patrik Dufresne

Merge branch 'develop/patrik/markdown-3' into 'master'

Make it work with Markdown 2.x and 3.x

See merge request !9
parents 1a1290c3 d40ebe29
Pipeline #512 passed with stages
in 1 minute and 14 seconds
# Change logs
## v1.1
Release date 26th of January, 2019
- Support Markdown v2.x and v3.x
## v1.0
Release date 21th of November, 2018
- Initial Release
......@@ -6,7 +6,10 @@ Created on Jun 8, 2018
'''
import markdown
from markdown.extensions import Extension
from markdown.inlinepatterns import LinkPattern
# Markdown v3.x
from markdown.inlinepatterns import Pattern
from markupsafe import Markup
import types
from weakref import ref as weakref
......@@ -33,7 +36,7 @@ def sanitize_link(self, link):
url = url_parse(link)
if not url.scheme:
link = get_ctx().record.url_to(link, base_url=get_ctx().base_url)
return LinkPattern.sanitize_url(self, link)
return Pattern.unescape(self, link)
def sanitize_image(self, link):
......@@ -44,7 +47,7 @@ def sanitize_image(self, link):
url = url_parse(link)
if not url.scheme:
link = get_ctx().record.url_to(link, alt=PRIMARY_ALT, base_url=get_ctx().base_url)
return LinkPattern.sanitize_url(self, link)
return Pattern.unescape(self, link)
class LektorMarkdownExtension(Extension):
......
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