1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

added markdown docs

This commit is contained in:
Bastian Venthur
2021-03-22 10:16:56 +01:00
parent 9c228165e9
commit cdc6639447

View File

@@ -1,3 +1,10 @@
"""Markdown Processing.
This module contains the methods responsible for blag's markdown
processing.
"""
from datetime import datetime
import logging
from urllib.parse import urlsplit, urlunsplit
@@ -34,6 +41,11 @@ def markdown_factory():
def convert_markdown(md, markdown):
"""Convert markdown into html and extract meta data.
Some meta data is treated special:
* `date` is converted into datetime with local timezone
* `tags` is interpreted as a comma-separeted list of strings.
All strings are stripped and converted to lower case.
Parameters
----------
md : markdown.Markdown instance
@@ -98,6 +110,9 @@ class MarkdownLinkTreeprocessor(Treeprocessor):
class MarkdownLinkExtension(Extension):
"""markdown.extension that converts relative .md- to .html-links.
"""
def extendMarkdown(self, md):
md.treeprocessors.register(
MarkdownLinkTreeprocessor(md), 'mdlink', 0,