X-Git-Url: https://git.phdru.name/?p=phdru.name%2Fphdru.name.git;a=blobdiff_plain;f=phd.py;h=f34437a9af1b647e5f3078f6978a0c14bd91ac67;hp=1e34234998a569fbe621cc7256bdd76c521044ed;hb=c978d4eac730a7fa0d578c4946fcc88854ba8aef;hpb=d80d48668f5a37bb5e06f8da9ac8950c5b6283c4 diff --git a/phd.py b/phd.py index 1e34234..f34437a 100644 --- a/phd.py +++ b/phd.py @@ -44,6 +44,8 @@ class phd(Template): return self.text2html() if hasattr(self, "body_rst"): return self.rst2html() + if hasattr(self, "body_mkd"): + return self.mkd2html() def text2html(self): body = re.sub(url_re, _url2href, self.body_text()) @@ -81,6 +83,9 @@ class phd(Template): parts = [part for part in (title, subtitle, body) if part] return "\n\n".join(parts) + def mkd2html(self): + from markdown import markdown + return markdown(self.body_mkd(), output_format="html") def img_thumbnail_800_1024(self, img_name): return """\