From f211c81a8ac084f4900f416a6285fcd17606bb97 Mon Sep 17 00:00:00 2001 From: linusdevx Date: Tue, 23 Jun 2026 07:59:01 +0530 Subject: [PATCH] fix(editor): handle --!> when stripping XML comment markers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The toggle-comment command stripped --> but not --!>, the rare-but-legal HTML comment-end-bang form. Browsers (and the HTML spec) treat both as valid comment terminators; toggling-off a buffer that used the bang form would leave a stray --!> on the line. Side benefit: closes CodeQL alert #1 (js/bad-tag-filter) on this line. The alert was technically a false positive — the regex output is fed into Monaco's text buffer, never rendered as HTML — but the underlying incompleteness was real, so it's worth fixing rather than dismissing. --- js/editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/editor.js b/js/editor.js index 9262cdc..8218d0a 100644 --- a/js/editor.js +++ b/js/editor.js @@ -270,7 +270,8 @@ require(['vs/editor/editor.main'], () => { if (allCommented) { for (let i = startLine; i <= endLine; i++) { const line = model.getLineContent(i); - const stripped = line.replace(/^(\s*)(\s*)$/, '$1'); + // --!?> matches both --> and --!>; the latter is rare but legal per the HTML spec. + const stripped = line.replace(/^(\s*)