wop commited on
Commit
5945c09
Β·
verified Β·
1 Parent(s): 92493c8

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +2 -35
templates/index.html CHANGED
@@ -1444,41 +1444,8 @@
1444
  /* ═══════════════════════════════════════════════
1445
  SYNTAX HIGHLIGHTER (lightweight)
1446
  ═══════════════════════════════════════════════ */
1447
- function syntaxHighlight(code, lang) {
1448
- // If the server already provided HTML-highlighted output (e.g. Pygments
1449
- // rendered <span class="tok-..."> tokens), it may arrive as raw
1450
- // markup or as escaped entities (&lt;span ...). In those cases we should
1451
- // render the existing highlight rather than escaping it again.
1452
- function decodeEntities(s) {
1453
- return String(s)
1454
- .replace(/&lt;/g, '<')
1455
- .replace(/&gt;/g, '>')
1456
- .replace(/&amp;/g, '&')
1457
- .replace(/&quot;/g, '"')
1458
- .replace(/&#39;/g, "'");
1459
- }
1460
-
1461
- // Quick heuristic: if code contains token spans (either raw or escaped),
1462
- // decode/return as-is so markup renders correctly.
1463
- if (/<span class=\"tok-/.test(code) || /&lt;span class=\"tok-/.test(code)) {
1464
- return /&lt;span/.test(code) ? decodeEntities(code) : String(code);
1465
- }
1466
-
1467
- const e = esc(code);
1468
- if (!lang || lang === 'text' || lang === 'plain') return e;
1469
- return e
1470
- // comments
1471
- .replace(/(\/\/[^\n]*|#[^\n]*|\/\*[\s\S]*?\*\/)/g, '<span class="tok-cmt">$1</span>')
1472
- // strings
1473
- .replace(/(["'`])((?:\\.|(?!\1)[^\\])*)\1/g, '<span class="tok-str">$1$2$1</span>')
1474
- // numbers
1475
- .replace(/\b(\d+\.?\d*)\b/g, '<span class="tok-num">$1</span>')
1476
- // keywords
1477
- .replace(/\b(function|const|let|var|return|if|else|for|while|class|import|export|from|async|await|def|self|print|True|False|None|int|str|bool|float|public|private|static|void|new|this|typeof|instanceof)\b/g, '<span class="tok-kw">$1</span>')
1478
- // function calls
1479
- .replace(/\b([a-zA-Z_]\w*)\s*(?=\()/g, '<span class="tok-fn">$1</span>')
1480
- // operators
1481
- .replace(/([=!<>\&|+\-*\/%^~]+)/g, '<span class="tok-op">$1</span>');
1482
  }
1483
 
1484
  /* ═══════════════════════════════════════════════
 
1444
  /* ═══════════════════════════════════════════════
1445
  SYNTAX HIGHLIGHTER (lightweight)
1446
  ═══════════════════════════════════════════════ */
1447
+ function syntaxHighlight(code, _lang) {
1448
+ return esc(code);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1449
  }
1450
 
1451
  /* ═══════════════════════════════════════════════