On 04Sep2022 15:34, raf via Mutt-users <mutt-users@mutt.org> wrote:
On Sun, Sep 04, 2022 at 01:51:25PM +1000, Cameron Simpson <c...@cskk.id.au>
wrote:
[...]
So I've revisited the manual and found the
`$send_multipart_alternative`
option and its friend `$send_multipart_alternative_filter`. They work well!
So now I have a mechanism to send: `format=flowed` MarkDown with a aparallel
HTML alternative. The HTML should render in a "paragraphy" way for the HTML
people, and the MarkDown keeps me happy.
My default setting is now:
set send_multipart_alternative=no
set send_multipart_alternative_filter='echo text/html; echo; exec md2html'
which is the inactive form, and I've added:
message-hook . 'set send_multipart_alternative=no'
message-hook '%f htmlees' 'set send_multipart_alternative=no'
Oops. That should be =yes above.
Whoops indeed. I just sketched this out this morning. Thanks for the
catch. fix applied.
The `md2html` script is my personal script, which wraps `pandoc` and
post
munges the HTML to indent the code blocks, which `pandoc`'s HTML does not
please my eye. It's here:
https://github.com/cameron-simpson/css/blob/main/bin-cs/md2html
if anyone wants a starting point.
Thanks, Cameron. It's odd that there isn't an md2html
program out there already. I had to create one too
(using python's markdown module).
Ah, that might be easier to customise. I just tried a few markdown
converters and ended up with pandoc.
I like your indenting of code blocks, but it seems to
put an additional blank line after each code block.
That might not be intentional.
Not intentional. I just wanted to keep the 4 space indent used to
trigger a code block for the same visual effect, since I use that
instead of the triple backticks usually. Pandoc tosses those spaces.
Pandoc's conversion is a bit clunky (but better than discount and the
other tool I tried).
And it looks like it
doesn't do titles (which default to "-"). I guess that
doesn't matter for email use, except that pandoc
whinges about it on stderr.
Aye, annoying. There's no context for a title (eg the subject header), I
may just have to provide something to shut it up. Or shift sideways to
the Python module, particularly if that does a better job.
Do you have any advice for automating spaces at the end
of non-final paragraph lines for format=flowed in vim?
I use these settings:
https://github.com/cameron-simpson/css/blob/main/bin/vim-flowed
which autowraps and leaves trailing spaces automatically.
Perhaps I could just post-process messages with perl
in my mutt-editor wrapper script.
Vim can do 99% of it for you on the fly :-)
Cheers,
Cameron Simpson <c...@cskk.id.au>