Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects

fixed incorrect block comment highlighting

1 file
+ 5
0
Compare changes
  • Side-by-side
  • Inline
@@ -63,7 +63,12 @@ const submissionGetter = mb.read(function submission (state, getters) {
? getters.submissionType.programmingLanguage
: 'c'
const highlighted = hljs.highlight(language, state.submission.text || '', true).value
let commentFlag = false
return highlighted.split('\n').reduce((acc: {[k: number]: string}, cur, index) => {
if (cur.includes("/*")) commentFlag = true
cur = commentFlag ? '<span class="hljs-comment">' + cur + '</span>' : cur
if (cur.includes("*/")) commentFlag = false // so that the ending line will also be greyed out
acc[index + 1] = cur
return acc
}, {})
Loading