Skip to content

Conversation

@alexdln
Copy link
Contributor

@alexdln alexdln commented Feb 10, 2026

Headings were getting lost in the readme. They were getting lost because we weren't processing them. That is, if a user added h1 or h2 via HTML, they weren't processed.

I added processing to them and all other levels that weren't processed via Markdown so that the correct style would be applied.

Closes #1093

@vercel
Copy link

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 10, 2026 1:21am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 10, 2026 1:21am
npmx-lunaria Ignored Ignored Feb 10, 2026 1:21am

Request Review

@alexdln
Copy link
Contributor Author

alexdln commented Feb 10, 2026

Unfortunately, the renderer will have to be rewritten, since we need to loop through both the HTML and MD from file in a single loop to ensure complete correctness. Otherwise, we can't guarantee the order in which headers are extracted and slugs are generated (especially with repeated content).

I didn't touch this here, since it would likely rewrite half the file. I'll create a new issue tomorrow

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

This PR modifies the README sanitisation logic in server/utils/readme.ts to be more permissive with allowed heading elements. It expands ALLOWED\_TAGS to include h1 and h2, introduces a helper function to calculate semantic heading depths with constraints (README h1 maps to h3, no level skipping, cap at h6), and adds transform handlers for heading tags to map them sequentially whilst preserving depth metadata via data-level attributes.

Possibly related PRs

Suggested reviewers

  • danielroe
  • trueberryless
  • serhalp
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description accurately describes the changes made: adding processing for HTML headings (h1, h2) and other heading levels that were not previously processed in README rendering.
Linked Issues check ✅ Passed The PR addresses issue #1093 by expanding ALLOWED_TAGS to include h1 and h2 headings and implementing semantic depth transformation for all heading levels to ensure proper rendering.
Out of Scope Changes check ✅ Passed All changes in server/utils/readme.ts are directly related to the objective of processing previously unsupported HTML headings and applying correct styles, with no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

@danielroe danielroe added this pull request to the merge queue Feb 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 10, 2026
@danielroe danielroe added this pull request to the merge queue Feb 10, 2026
Merged via the queue into npmx-dev:main with commit 299a877 Feb 10, 2026
17 checks passed
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.

🐛 Bug: Allowed DOM elements and attributes less permissive than npm

2 participants