neomutt: Add html-email creation pipeline to compose menu
Hitting `,m` in the compose menu creates a dual txt/html email group when the highlighted file is written in (djot) markdown. Delete the original message afterwards to create a fully functional html email with plaintext fallback. Completely taken from: https://tom.wemyss.net/posts/neomutt-markdown-email/ with many thanks. What an amazing use of pipelines in neomutt!
This commit is contained in:
parent
4693f3f6dd
commit
a1a12cc54c
2 changed files with 36 additions and 0 deletions
|
|
@ -187,6 +187,17 @@ bind attach l view-mailcap
|
|||
# macro index x "<limit>all\n" "show all messages (undo limit)"
|
||||
# macro index \ci "<limit>~F\n" "Limit by flagged"
|
||||
|
||||
# Write (djot-flavored) markdown and instantly transform it into a TXT/HTML result
|
||||
# HTML-enabled email readers display that and others can still enjoy a txt representation
|
||||
macro compose ,m \
|
||||
"<enter-command>set pipe_decode<enter>\
|
||||
<pipe-message>pandoc -f gfm -t plain -o /tmp/msg.txt<enter>\
|
||||
<pipe-message>pandoc -s -f gfm --standalone --embed-resources -o /tmp/msg.html --template email<enter>\
|
||||
<enter-command>unset pipe_decode<enter>\
|
||||
<attach-file>/tmp/msg.txt<enter>\
|
||||
<attach-file>/tmp/msg.html<enter>\
|
||||
<tag-entry><previous-entry><tag-entry><group-alternatives>" \
|
||||
"Convert markdown to HTML5 and plaintext alternative content types"
|
||||
|
||||
#
|
||||
#
|
||||
|
|
|
|||
25
writing/pandoc/local/share/pandoc/templates/email.html
Normal file
25
writing/pandoc/local/share/pandoc/templates/email.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="$lang$" xml:lang="$lang$"$if(dir)$ dir="$dir$"$endif$>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<style>
|
||||
$styles.html()$
|
||||
</style>
|
||||
$for(css)$
|
||||
<link rel="stylesheet" href="$css$" />
|
||||
$endfor$
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
$for(header-includes)$
|
||||
$header-includes$
|
||||
$endfor$
|
||||
</head>
|
||||
<body>
|
||||
$body$
|
||||
$for(include-after)$
|
||||
$include-after$
|
||||
$endfor$
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue