Autolab icon indicating copy to clipboard operation
Autolab copied to clipboard

No syntax highlighting for multiple line comments

Open victorhuangwq opened this issue 1 year ago • 4 comments

The comment on lines 2 and 3 is black instead of green

Issue has been around for a while (including on prod!) but for some reason no one quite attended to it

Incorrect syntax highlighting physically hurts my eyes 😢 - Oliver

Image

victorhuangwq avatar Jan 29 '23 19:01 victorhuangwq

Unfortunately, updating to the last version of highlight.js (v11.7.0) doesn't seem to fix it.

Style does change slightly though: Screenshot 2023-01-30 at 14 47 45

damianhxy avatar Jan 30 '23 19:01 damianhxy

On second thoughts, it's probably because of this code in annotations.js

    // Add syntax highlighting to the new code viewer
    $('pre code').each(function () {
      hljs.highlightBlock(this);
    });

I think oliver had a wip branch speedgrader-syntax-fix, it might be worth further investigation

damianhxy avatar Feb 08 '23 07:02 damianhxy

It's mainly because the syntax highlighting is done line by line instead of the whole file

victorhuangwq avatar Feb 08 '23 17:02 victorhuangwq

Could consider using https://github.com/wcoder/highlightjs-line-numbers.js

damianhxy avatar Jan 06 '24 04:01 damianhxy