commit c948694716079be15688d937139961472d417118 (patch)
parent c719595d85adc55a254315d7c7f96ffe7f5f675d
Author: Alex Karle <alex@karle.co>
Date: Thu, 26 Sep 2019 00:22:55 -0400
mutt: add macro for pandoc HTML email generation
Using neomutt's multipart/alternative grouping mechanism, we can
generate an HTML email (with a custom stylesheet!) and then group it
with the markdown plaintext used to generate it.
This is a nice compromise between those who like to view the HTML and
those who prefer plaintext.
One open question is whether this holds up well in terms of preserving
the HTML of the thread. Only time will tell!
NOTE: requires neomutt . As of now, no multipart/alternative support for
mutt.
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/mutt/header.html b/mutt/header.html
@@ -0,0 +1,7 @@
+<style>
+blockquote {
+ margin-left: 0px; /* Override pandoc default of 40 */
+ border-left: 2px solid gray;
+ padding-left: 5px;
+}
+</style>
diff --git a/mutt/muttrc b/mutt/muttrc
@@ -34,6 +34,12 @@ set query_command="abook --mutt-query '%s'"
# Show some index in the pager
set pager_index_lines=10
+# Enables shelling out in macros without a pause
+set wait_key=no
+
+# For pandoc, we need an extra line before the block quotes
+set attribution="On %d, %n wrote:\n"
+
################################################################################
# Bindings
# I've chosen to customize-as-I-go on these. Some general guiding rules:
@@ -71,3 +77,5 @@ bind editor <Tab> complete-query # Used for contact-completion
# Macros
macro index,pager ga "<pipe-message>abook --add-email-quiet<return>" "Add sender to abook contacts"
+
+macro compose K "|pandoc -s -H ~/.config/mutt/header.html -o /tmp/mutt-alt.html<enter><attach-file>/tmp/mutt-alt.html<enter><tag-entry><previous-entry><tag-entry>"