Skip to content

Conversation

@TheAlexLichter
Copy link
Contributor

Resolves #1354

Not ideal as packages might have no description then but given that the description is fetched directly from NPM, we could only parse the README and take the first non-comment line.
This could be done in another iteration if worth it

@vercel
Copy link

vercel bot commented Feb 11, 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 11, 2026 11:47pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 11, 2026 11:47pm
npmx-lunaria Ignored Ignored Feb 11, 2026 11:47pm

Request Review

@codecov
Copy link

codecov bot commented Feb 11, 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 11, 2026

📝 Walkthrough

Walkthrough

The changes modify the useMarkdown composable to remove HTML comments from sanitised content. The stripAndEscapeHtml function now includes logic to strip HTML comment blocks (<!-- ... -->) after removing HTML tags. Additional test cases were added to verify comment removal across various scenarios, including single-line, middle, multiple and multiline comments, as well as strings containing only comments.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description directly references the linked issue #1354 and explains the changes made to strip HTML comments from package descriptions.
Linked Issues check ✅ Passed The changes successfully address issue #1354 by stripping HTML comments from package descriptions, with test coverage for various comment scenarios.
Out of Scope Changes check ✅ Passed All changes are directly focused on removing HTML comments from descriptions as specified in issue #1354; 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

No actionable comments were generated in the recent review. 🎉


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

stripped = stripped.replace(/<\/?[a-z][^>]*>/gi, '')

// Strip HTML comments: <!-- ... -->
stripped = stripped.replace(/<!--[\s\S]*?-->/g, '')
Copy link
Member

@alexdln alexdln Feb 11, 2026

Choose a reason for hiding this comment

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

As far as I understand, when there's no description in package.json, npm and algolia takes the description from Markdown. If the comment is long, only the opening tag will remain. What do you think about additional check so that in this case it's truncated to the end?


p.p.s. just note - [\s\S]* is equal to [\s\S]{0,}, i.e. * means that there are more than 0 matches of any character. Therefore, the optional character (?) is not needed here. The optional character may be needed when testing with + instead of *, that equal to [\s\S]{1,} (at least one any character)

Copy link
Contributor Author

@TheAlexLichter TheAlexLichter Feb 11, 2026

Choose a reason for hiding this comment

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

Ah, I was consider adding it but didn't know how the description is retrieved. Let me update the logic.

Note on the regex: *? is used to be non-greedy and not match more than wanted.

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.

Hide comments from description in search restults

2 participants