Skip to content

Allow <details> and <summary> HTML tags in sanitized output#416

Open
ppastur wants to merge 1 commit into
ryanlelek:mainfrom
ppastur:fix/details-summary-html-tags
Open

Allow <details> and <summary> HTML tags in sanitized output#416
ppastur wants to merge 1 commit into
ryanlelek:mainfrom
ppastur:fix/details-summary-html-tags

Conversation

@ppastur

@ppastur ppastur commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #412

The sanitizeHtmlOutput function uses sanitize-html with an explicit tag allowlist. <details> and <summary> were not included, so native HTML collapsible sections were silently stripped from rendered pages regardless of the config.markdown.html: true setting (which only affects the marked step, not the subsequent sanitization pass).

Changes

  • Added 'details' and 'summary' to allowedTags
  • Added 'open' to allowedAttributes for details, so <details open> renders correctly (section expanded by default)

Test

A wiki page with the following content now renders collapsible sections correctly:

```markdown

Click to expand

Content here.

\`\`\`

Adds 'details' and 'summary' to the sanitize-html allowedTags list so
native HTML collapsible sections work in wiki pages. Also adds 'open'
to allowedAttributes so <details open> renders correctly.

Fixes ryanlelek#412
@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.58%. Comparing base (a42f280) to head (7d0065f).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #416   +/-   ##
=======================================
  Coverage   62.58%   62.58%           
=======================================
  Files          33       33           
  Lines         850      850           
  Branches      236      236           
=======================================
  Hits          532      532           
  Misses        269      269           
  Partials       49       49           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ppastur

ppastur commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

Hi @ryanlelek , I had a little time to look at this and created a fix for your review. Ive tested this locally and seems to fix the issue. Let me know if there is anything you would like changed.

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.

Question: Can you use "<details>" to collapse sections

2 participants