From abc2bb243c3cb2de615f43657bcb0bee168789bc Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Mon, 26 Aug 2019 23:18:55 +0200 Subject: [PATCH] markdown with mistune --- makesite.py | 6 +++--- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/makesite.py b/makesite.py index 26bf5ed..6ffd38a 100755 --- a/makesite.py +++ b/makesite.py @@ -39,7 +39,7 @@ from pathlib import Path import unicodedata import locale import requests -import commonmark +import mistune # set user locale locale.setlocale(locale.LC_ALL, "") @@ -123,7 +123,7 @@ def read_content(filename): # Convert Markdown content to HTML. if filename.endswith((".md", ".mkd", ".mkdn", ".mdown", ".markdown")): - text = commonmark.commonmark(text) + text = mistune.markdown(text) # Update the dictionary with content and RFC 2822 date. content.update({"content": text, "rfc_2822_date": rfc_2822_format(content["date"])}) @@ -233,7 +233,7 @@ def make_posts( avatar=comment.get("avatar", ""), site=comment.get("site", ""), date=comment["date"], - content=commonmark.commonmark(comment["content"]), + content=mistune.markdown(comment["content"]), ) out_comments.append(out_comment) page_params["comments"] = "".join(out_comments) diff --git a/requirements.txt b/requirements.txt index fe2ad2f..a6f708e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,9 +4,9 @@ black==19.3b0 certifi==2019.6.16 chardet==3.0.4 Click==7.0 -commonmark==0.9.0 future==0.17.1 idna==2.8 +mistune==0.8.4 requests==2.22.0 toml==0.10.0 urllib3==1.25.3