Skip to content

Render advisory descriptions as Markdown in the popup - #674

Open
PekSec wants to merge 1 commit into
RetireJS:masterfrom
PekSec:popup-advisory-markdown
Open

PekSec wants to merge 1 commit into
RetireJS:masterfrom
PekSec:popup-advisory-markdown

Conversation

@PekSec

@PekSec PekSec commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Problem

About half of the advisories (425 of 821) have a details text written in GitHub advisory Markdown. The popup showed it as one plain paragraph, so ### headings, lists and code fences ran together. Some texts are very long: the median is about 1,200 characters and the longest about 31,000.

Change

  • Descriptions are rendered as Markdown: headings, bullet and numbered lists, code blocks, inline code, bold, italic and links.
  • Descriptions over 800 characters are cut at a block boundary and continue behind Read more / Show less. A heading is never left alone above the button.
  • No dependency and no innerHTML. Every node is created with the existing element() and safeLink() helpers, so raw HTML in a description stays visible as text and only HTTP(S) links become links.
  • Kept simple: tables are shown as preformatted text and nested lists are flattened.
  • The advisory title and the JSON export are unchanged.

Advisory description with Read more, light

Advisory description with Read more, dark

Testing

  • 38 unit tests pass (cd chrome/build && npm test). The new tests cover rendering, unsafe input and the collapse rule. One test runs every description in the repository, plus inputs built to make regular expressions slow, through the renderer with a time limit.
  • The Chrome smoke check (both Chrome packages, Chrome 158) and the Firefox smoke check (Firefox 161) pass.
  • The three prebuilt packages are rebuilt and the two 04-library-advisories screenshots are updated. The service workers also pick up the node/lib/retire.js change from da66c52, which the prebuilt packages on master do not have yet.

This is independent of #673. Both rebuild the service workers, so the one merged second needs a rebuild after merging master.

AI-assisted implementation.

🤖 Generated with Claude Code

Advisory descriptions are GitHub advisory Markdown, up to about 31,000
characters, and were shown as one plain paragraph.

The details view now renders headings, lists, code blocks, inline code,
bold, italic and HTTP(S) links. Descriptions over 800 characters
collapse at a block boundary behind "Read more" / "Show less".

The renderer has no dependencies and never uses innerHTML: every node
comes from the existing element() and safeLink() helpers, raw HTML stays
visible as text, and other link protocols stay plain text. Tables are
shown as preformatted text and nested lists are flattened.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant