mh-e: HTML
6.3 HTML
========
MH-E can display messages that have been sent in HTML. The content of
the message will appear in the MH-Show buffer as you would expect if the
entire message is HTML, or there is an inline HTML body part. However,
if there is an HTML body part that is an attachment, then you’ll see a
button like this:
[1. text/html; foo.html]...
To see how to read the contents of this body part, see Viewing
Attachments.
The browser that MH-E uses is determined by the option
‘mm-text-html-renderer’. The default setting is set automatically based
upon the presence of a known browser on your system. If you wish to use
a different browser, then set this option accordingly. See the
documentation for the browser you use for additional information on how
to use it. In particular, find and disable the option to render images,
as displaying remote images can tip off spammers that the email address
they have used is valid.
If you’re confused about which ‘mm-text-html-renderer’ to use, here’s
a brief description of each, sorted by name.
‘gnus-w3m’
The ‘gnus-w3m’ browser requires an external program. It’s quick,
produces pretty nice output, and it highlights links. It renders
‘–’ and ‘®’ okay. It sometimes fails to wrap lines
properly. It always downloads remote images.
‘html2text’
The ‘html2text’ browser requires an external program. Some users
have reported problems with it, such as filling the entire message
as if it were one paragraph, or displaying chunks of raw HTML.
‘links’
The ‘links’ browser requires an external program. It’s quick, and
produces nicer output than ‘lynx’ on single column mails in tables.
However, it doesn’t show links and it doesn’t do as nice a job on
multi-column tables as some lines wrap. It does do a good job of
fitting text within 80 columns. It appears to render special
characters using ASCII equivalents. For example, ‘®’ appears
as (R). It does not download images.
‘lynx’
The ‘lynx’ browser requires an external program. It’s quick and
produces pretty decent output but it doesn’t show links. It
doesn’t seem to do multi-column tables which makes output much
cleaner. It centers the output and wraps long lines more than
most. It does not always handle special characters like ‘®’ or
‘–’. It does not download images.
‘nil’
This choice obviously requires an external browser. With this
setting, HTML messages have a button for the body part which you
can view with ‘K v’ (‘mh-folder-toggle-mime-part’). Rendering of
special characters and handling of remote images depends on your
choice of browser.
‘shr’
This choice does not require an external program, but it does
require that Emacs be configured at build time to use ‘libxml2’.
It is fairly quick, it highlights links, and it supports HTML color
declarations. It renders ‘–’ and ‘®’ okay. It sometimes
truncates text, particularly if the message tries to have fancy
text layout. By default it does not download images; this behavior
is controlled by the options ‘mm-html-blocked-images’ and
‘mm-html-inhibit-images’ ((emacs-mime)Display
Customization).
‘w3m’
The ‘w3m’ browser requires an external program. It’s quick,
produces pretty nice output, and it highlights links. These can be
clicked with ‘mouse-2’ to view the content of the link in ‘w3m’.
The ‘w3m’ browser handles tables well and actually respects the
table’s width parameter (which can cause text to wrap if the author
didn’t anticipate that the page would be viewed in Emacs). It does
not download images by default; this behavior is controlled by the
option ‘mm-w3m-safe-url-regexp’ ((emacs-mime)Display
Customization).
‘w3m-standalone’
This browser is quick, but does not show links. It handles simple
tables but some tables get rendered much wider than the Emacs
frame. This browser renders ‘–’ and ‘®’ okay. It does
not download images.
For a couple more sources of information about
‘mm-text-html-renderer’, (emacs-mime)Display Customization, and
the documentation for the Gnus command ‘W h’ ((gnus)Article
Washing).
A useful key binding that you can add to ‘~/.emacs’ is the following
which displays an HTML link or textual URL in an external browser when
clicked with ‘S-mouse-2’. This binding works in any buffer, including
HTML buffers.
(global-set-key [S-mouse-2] 'browse-url-at-mouse)