mirror of
https://github.com/boostorg/website-v2-docs.git
synced 2026-01-19 16:52:16 +00:00
refactor: improve code readability in C++ syntax highlighting logic
This commit is contained in:
10
antora-ui/src/js/vendor/cpp-highlight.js
vendored
10
antora-ui/src/js/vendor/cpp-highlight.js
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user