Skip to content

text: Support HTML <mark> tag with highlight color#2515

Merged
madcodelife merged 1 commit into
mainfrom
support-html-mark-tag
Jun 26, 2026
Merged

text: Support HTML <mark> tag with highlight color#2515
madcodelife merged 1 commit into
mainfrom
support-html-mark-tag

Conversation

@ylinwind

@ylinwind ylinwind commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Adds support for the HTML <mark> tag in the text/HTML renderer, rendering marked text with a background highlight.

The highlight color is customizable via the color attribute or the background-color style declaration, parsed by the existing try_parse_color helper:

<mark>highlighted</mark>                                   <!-- default light yellow -->
<mark color="blue-200">blue tint</mark>                   <!-- Tailwind scale -->
<mark color="amber/30">amber, 30% opacity</mark>          <!-- opacity modifier -->
<mark style="background-color: #fca5a5">custom hex</mark>  <!-- hex -->
  • Accepts hex (#3366ff), named colors (blue), Tailwind scales (blue-200), and opacity (amber/30).
  • Defaults to a light yellow highlight when no color is given.

TextMark gains an additive highlight: Option<Hsla> field (private module, not part of the public API). The <mark> demos were added to the HTML example fixture, with a unit test covering the tag.

Note: AI-generated code, refactored to match project style.

@ylinwind ylinwind force-pushed the support-html-mark-tag branch from 656b912 to dd00907 Compare June 26, 2026 03:53
@madcodelife madcodelife self-assigned this Jun 26, 2026
Render `<mark>` as highlighted text in the HTML formatter. The
highlight color can be customized via a `color` attribute or the
`background-color` style declaration, accepting hex (`#3366ff`) or
named colors (`blue`). Defaults to a light yellow highlight.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ylinwind ylinwind force-pushed the support-html-mark-tag branch from dd00907 to 4db7aec Compare June 26, 2026 03:57
@madcodelife madcodelife enabled auto-merge (squash) June 26, 2026 04:00
@madcodelife madcodelife merged commit 063e55b into main Jun 26, 2026
3 checks passed
@madcodelife madcodelife deleted the support-html-mark-tag branch June 26, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants