from future.standard_library import install_aliases
install_aliases() # noqa
from markdown import markdown as md
from urllib.parse import urljoin
# Jinja2 template filters
[docs]def markdown(text):
"""
Returns the rendered version of the given Markdown text
"""
return md(text, tab_length=2,
extensions=['markdown.extensions.fenced_code'])
[docs]def absolute_url_func(site):
"""
Returns a markdown filter function that returns an absolute URL for the
given relative URL, simply concatenating config['base_url'] with the URL.
"""
def absolute_url(path):
return urljoin(site.config['base_url'], path)
return absolute_url