Skip to content

Reader: make the 'o' HTML renderer configurable — w3m has no CSS, so preheader text (display:none) shows in the body #26

Description

@edwinhu

o in the reader is hardcoded to w3m (internal/ui/model.go:3931, exec.Command("w3m", tmpPath)), so it cannot be pointed at a terminal browser that implements CSS.

This matters more for email than for general browsing, because w3m has no CSS support at all. Demonstrated on a minimal document:

<html><style>.h{color:red;font-weight:bold}</style>
<body><p class=h>STYLED</p>
<div style="display:none">HIDDEN-SHOULD-NOT-APPEAR</div>
<p>plain</p></body></html>
$ w3m -dump /tmp/t.html
STYLED
HIDDEN-SHOULD-NOT-APPEAR
plain

w3m(1) has no mention of css or stylesheet; it renders HTML structure and ignores styling.

Why this bites email specifically

HTML email uses display:none for preheader text — the hidden preview line most senders put at the top of the document for the inbox list. Opening such a message with o shows that hidden text as body content, above the real message. Marketing mail also leans on inline styles for layout, which flattens.

Chawan is a terminal browser with a real CSS implementation (its manual documents css(7) and a user stylesheet), so it honours display:none and inline styling. It is a drop-in for this use — same "write HTML to a temp file, open it, resume on exit" shape.

Suggested shape

A config key, matching the two external-command hooks that already exist:

[reader]
html_command = "w3m"   # default: current behaviour
# html_command = "cha"
# html_command = "lynx"

That mirrors [ai].command (docs/.../configuration/#ai-handoff) and [calendar].open_command, so it fits the existing config surface rather than adding a new concept. tea.ExecProcess is already correct for any TUI process, so the change is the command name and an args slice.

Happy to send a PR if the shape is agreeable — including whether you would prefer args alongside it (as [ai] has) for renderers that need flags.

Environment

neomd 0.8.7 (prebuilt linux_amd64 release), Linux, reading two accounts over IMAP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions