Skip to content

fix: improve comment removal - #604

Open
majestic-owl448 wants to merge 1 commit into
freeCodeCamp:mainfrom
majestic-owl448:fix/comment-regex
Open

majestic-owl448 wants to merge 1 commit into
freeCodeCamp:mainfrom
majestic-owl448:fix/comment-regex

Conversation

@majestic-owl448

Copy link
Copy Markdown
Contributor

Checklist:

Improve all four comment-removal helpers without adding dependencies. For example, Python floor division (10 // 2) and comment markers inside strings are preserved, CSS empty comments are removed, HTML attribute values are preserved, and JavaScript block comments no longer merge tokens or erase meaningful line breaks.

Add 62 regression cases, including 37 that fail on the original implementation. Update two existing JavaScript expectations to reflect non-nesting block comments and preserved line breaks.

This is a targeted improvement. JSX, JavaScript regex literals and template interpolations, Python f-string expressions, and HTML raw-text elements still require further work.

This is an improvement of the existing regex, before going to a parser, which usefulness need to be properly evaluated.

@majestic-owl448
majestic-owl448 requested a review from a team as a code owner September 17, 2026 10:13
@majestic-owl448 majestic-owl448 changed the title fix: improve comment removal without dependencies fix: improve comment removal Sep 17, 2026

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