Closed KesterTan closed 4 weeks ago
It seems that on initial load, the highlighting works, but switching to other files breaks the highlighting (the file will revert back to broken highlighting
https://github.com/autolab/Autolab/assets/25730111/a6a4000c-8933-4ec3-bb5e-aa1e32d5cb16
Discussed offline that this PR still has some issues with highlighting, so needs a second attempt / revision.
Updated highlighting code highlights code even if we change files.
Highlighting code also takes into account keywords such as "#include', previously these were flagged out as comments.
To check that it works as expected, check that the output is the same as that in: https://highlightjs.org/demo
seems like the issue with #include getting turned into a comment also happens with #define. Functionally though the multi-line comments seem to work a lot more reliably now. Might be worth looking into updating highlight.js since it seems like the local highlight.pack.js
was last updated in 2015, so these issues might have been fixed in later releases. Other than nit, LGTM for the most part.
Fixes #1732.
Before, multi-line comments were not highlighted:
With this change:
How Has This Been Tested?
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for linting