Skip to content

feat: add sanitizeTextForRender method#58

Merged
scmmishra merged 8 commits intomainfrom
feat/sanitize-text
Sep 4, 2025
Merged

feat: add sanitizeTextForRender method#58
scmmishra merged 8 commits intomainfrom
feat/sanitize-text

Conversation

@scmmishra
Copy link
Member

No description provided.

@scmmishra scmmishra changed the title feat: add sanitizeTextForRender method feat: add sanitizeTextForRender method Sep 4, 2025
@scmmishra scmmishra requested a review from Copilot September 4, 2025 05:59
@github-actions
Copy link

github-actions bot commented Sep 4, 2025

size-limit report 📦

Path Size
dist/utils.cjs.production.min.js 11.82 KB (0%)
dist/utils.esm.js 11.36 KB (0%)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new sanitizeTextForRender function to the string utilities that escapes potentially dangerous characters while preserving valid HTML tags. The function converts newlines to <br> tags and escapes stray < and > characters that aren't part of valid HTML tags.

  • Implements sanitizeTextForRender function with regex-based HTML tag detection
  • Adds comprehensive test coverage with 15 test cases covering various scenarios
  • Updates package version and exports the new function

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/string.ts Implements the new sanitizeTextForRender function with detailed documentation
test/string.test.ts Adds comprehensive test suite with edge cases and real-world scenarios
src/index.ts Exports the new function from the main module
package.json Bumps version from 0.0.50 to 0.0.51

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@scmmishra scmmishra merged commit 097e00a into main Sep 4, 2025
6 of 7 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.

1 participant