refactor: improve code readability in C++ syntax highlighting logic

This commit is contained in:
Julio Estrada
2025-12-12 14:35:41 -05:00
parent 3016e695a9
commit dae11b7497

View File

@@ -76,7 +76,15 @@ const CppHighlight = (function () {
i += 2
let depth = 1
while (i < n && depth > 0) {
if (code.slice(i, i + 2) === '[[') { depth++; i += 2 } else if (code.slice(i, i + 2) === ']]') { depth--; i += 2 } else i++
if (code.slice(i, i + 2) === '[[') {
depth++
i += 2
} else if (code.slice(i, i + 2) === ']]') {
depth--
i += 2
} else {
i++
}
}
result.push(span('attribute', code.slice(start, i)))
continue