[Alpine-info] using w3m to view HTML attachments is pretty nice

Mike Miller mbmiller+l at gmail.com
Sat May 14 01:30:39 PDT 2011

I'm using Alpine on an Ubuntu Linux box. I usually pump HTML attachments
into chromium-browser if I want a better view, but that can be overkill.
I find the alpine HTML viewer is often inadequate. But I now find that
the w3m viewer does a nice job. I just pipe "|" the HTML attachment into
w3m with the -T text/html argument (a script or alias could make that
easier), and I choose Free Output (^Y toggle):

Pipe attachment 1.2 to (Free Output) : w3m -T text/html

It does an especially nice job with tables. Some of you might like it.

While you're in it, you can use H to see help (but I couldn't figure out
how to leave help without quitting!). To search forward, use /, and to
search backward, use ?. Use Q to quit without prompt and return to

Next time you use pipe, it will remember your last pipe command and you
won't have to retype it.

Another very cool trick is to use w3m to translate an HTML attachment to a
plain text file that you can then bring back into Alpine. I did one
example like so:

Pipe attachment 1.2 to (Free Output) : w3m -dump -cols 74 -T text/html > html_attachment.txt

Then I returned to composing this message and used ^R to bring in the
html_attachment.txt file. It really was 74 characters wide and didn't
change if I used ^J to justify. It was using block quoting nicely and it
had no spaces at the ends of the lines -- which means it wouldn't look
wrong with flowed-text on. It included a table, and I show a part of it

│ Gene │ Chromosome │ MacDonald 003 │
│ COMT │ 22 │ rs737865 │
│ APOE │ 19 │ rs7412 │
│ DAOA │ 13 │ rs778293 │
│ PDE4B │ 1 │ rs910694 │
│ RPGRIP1L │ 16 │ rs9922369 │
│ TCF4 │ 18 │ rs9960767 │

That table looks pretty great (at least here and now before sending --
it's using box-drawing characters to produce cells of the table). I have
used lynx -dump before and have never gotten tables looking that nice.


More information about the Alpine-info mailing list