X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/d7764d3d5c38f3697b1fb6252653982329d13310..a43c595fdaf36f34955585d2941f25d2b9821011:/.config/mutt/markdown2html?ds=inline diff --git a/.config/mutt/markdown2html b/.config/mutt/markdown2html index e1ce9af..2431bb8 100755 --- a/.config/mutt/markdown2html +++ b/.config/mutt/markdown2html @@ -111,7 +111,7 @@ def _preprocess_signature(sig): ''' Preprocess the signature before markdown processing. ''' - return sig + return f"```\n{sig}\n```" def _preprocess_markdown(mdwn): ''' @@ -292,7 +292,7 @@ def convert_markdown_to_html(mdwn): Converts the input Markdown to HTML, handling separately the body, as well as an optional signature. ''' - parts = re.split(r'^-- $', mdwn, 1, flags=re.MULTILINE) + parts = re.split(r'^-- \n', mdwn, 1, flags=re.MULTILINE) body = parts[0] if len(parts) == 2: sig = parts[1] @@ -311,8 +311,9 @@ def convert_markdown_to_html(mdwn): if sig: sig = _preprocess_signature(sig) sig = _preprocess_markdown(sig) + print(sig, file=sys.stderr, end='') sig = _convert_with_pandoc(sig, standalone=False, selfcontained=False) - sig = SIGNATURE_HTML.format(sig='
'.join(sig.splitlines())) + sig = SIGNATURE_HTML.format(sig=sig) eob = html.find('') html = f'{html[:eob]}{sig}\n{html[eob:]}'