;; remove Markdown
 markings
    (goto-char signature-position)
    (while (re-search-forward "^```" nil t)
      (replace-match ""))))

For those who can't read elisp for breakfast, this does the following:

 1. parse the current email body as markdown, in a separate buffer
 2. make the current email multipart/alternative
 3. add an HTML part
 4. inject the HTML version in the HTML part

There's some nasty business with formatting the signature correctly by
wrapping it in a 
 that's going on there - I took that from
Thunderbird as well.

(For those who *do* read elisp for breakfast, improvements and comments
on the coding style are very welcome.)

The idea is that you write your email normally, but in markdown. When
you're done writing that email, you launch the above function (carefully
bound to "M-x anarcat/notmuch-html-convert" here) which takes that email
and adds an equivalent HTML part to it. You can then even tweak that
part to screw around with the raw HTML if you feel depressed or
nostalgic.

What do people think? Am I insane? Could this work? Does this belong in
notmuch? Or maybe in the tips section? Should I seek therapy? Do you
hate markdown? Expand on the relationship between your parents and text
editors.

Thanks for any feedback,

A.

PS: the above, naturally, could be adapted to parse the body as RST,
asciidoc, texinfo, latex or whatever insanity you think would be more
appropriate, I don't care. The idea is the same.

PPS: I remember reading about someone wanting to declare a text/markdown
mimetype for email, and remembering it was all backwards and weird and I
can't find the reference anymore. If some lazyweb magic person could
forward the link to me I would be grateful.

 [1]: one of so many: https://www.georgedillon.com/web/html_email_is_evil_still.shtml
 [2]: https://en.wikipedia.org/wiki/Netscape_Communicator
 [3]: yes my age is showing
 [4]: to be fair, this article encouraged me quite a bit:
 https://blog.chaddickerson.com/2019/01/09/replacing-facebook/
 [5]: not the bass guitar one, unfortunately
 [6]: https://en.wikipedia.org/wiki/HTML_email#Adoption
 [7]: https://trey-jackson.blogspot.com/2008/01/emacs-tip-8-markdown.html