From b22aabe2c3ad76dc659bd2aaf3b5f2e72da38fd2 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 22 Mar 2026 04:19:06 -0400 Subject: [PATCH] Fix // in URLs triggering comment highlighting Only match // comments at line start, not inside URLs. Co-Authored-By: Claude Opus 4.6 (1M context) --- tuftecms/templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuftecms/templates/base.html b/tuftecms/templates/base.html index 449d0b9..749b79a 100644 --- a/tuftecms/templates/base.html +++ b/tuftecms/templates/base.html @@ -591,8 +591,8 @@ // Python class names (class ClassName) html = html.replace(/(\bclass\s+)([A-Za-z_][A-Za-z0-9_]*)/g, '$1$2'); - // JavaScript/C++/Java comments (// comment) - html = html.replace(/(\s*\/\/.*)$/gm, '$1'); + // JavaScript/C++/Java comments (// comment) - only at line start, not in URLs + html = html.replace(/^(\s*\/\/.*)$/gm, '$1'); // CSS/C/Java block comments (/* comment */) html = html.replace(/(\/\*[\s\S]*?\*\/)/g, '$1');