php / php/web-news

Handle HTML formatted messages better

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
12
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Currently, messages with a text/html part but no text/plain are just run through strip_tags() to remove all tags.

HTML email isn't going away, so we could handle it better, especially with the new HTML parsing capabilities in PHP 8.4. We could parse it, strip it down to just tags we want to allow, and mark those up with classes so it gets styled reasonably (like quoting levels).

It may even make sense to favor the text/html format when we get both. For example, this message has a text/plain part that is totally devoid of formatting, but the HTML is already pretty simple (div, blockquote, etc).

(My goal with this is to present the messages that are sent to the PHP lists, particularly internals@, as usefully as we can, which means I'm willing to go to special lengths to handle what is actually being sent by active participants. https://externals.io gets pretty far with just shoving all the plain-text through Markdown, but I'd like to do better.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the message-rendering path that currently sends HTML-only parts through strip_tags(), and review the PHP 8.4 HTML parsing capabilities mentioned in the issue. Done means HTML-only messages are handled with an allowlisted, styled subset of markup, with a clear decision about when HTML should be preferred over plain text.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.