mirror of
https://github.com/kennethreitz/kennethreitz.org.git
synced 2026-06-05 22:50:17 +00:00
Fix // in URLs triggering comment highlighting
Only match // comments at line start, not inside URLs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -591,8 +591,8 @@
|
||||
// Python class names (class ClassName)
|
||||
html = html.replace(/(\bclass\s+)([A-Za-z_][A-Za-z0-9_]*)/g, '$1<span style="font-weight: bold;">$2</span>');
|
||||
|
||||
// JavaScript/C++/Java comments (// comment)
|
||||
html = html.replace(/(\s*\/\/.*)$/gm, '<span style="color: #888; font-style: italic;">$1</span>');
|
||||
// JavaScript/C++/Java comments (// comment) - only at line start, not in URLs
|
||||
html = html.replace(/^(\s*\/\/.*)$/gm, '<span style="color: #888; font-style: italic;">$1</span>');
|
||||
|
||||
// CSS/C/Java block comments (/* comment */)
|
||||
html = html.replace(/(\/\*[\s\S]*?\*\/)/g, '<span style="color: #888; font-style: italic;">$1</span>');
|
||||
|
||||
Reference in New Issue
Block a user