Include 'dockerfile' in highlight.js syntax highlighting for code blocks

Description

For challenges (and other projects), we use code blocks in wiki markdown to provide examples and templates for creating Dockerfiles. The version of highlight.js that Synapse currently uses for syntax highlighting doesn't seem to know what to do with the docker or dockerfile class.

Here's what it looks like currently:

Here's what I'd expect it to look like (from https://highlightjs.org/static/demo/):

Confirmation that syntax highlighting for R seems to work fine:

This might be a separate issue, but formatting for shell also doesn't really look like I would expect:

And plaintext doesn't seem to work (should disable syntax highlighting):

Environment

None

Activity

Show:
Jay Hodgson
January 14, 2020, 11:32 PM

: Not entirely sure. But the old version of highlight.js that we were using recognizes my example code as “bash“, where the new version marks it as “nginx“, so you might see an improvement here too.

James Eddy
January 14, 2020, 11:36 PM

Ah, nice. That should work well enough.

Xavier Schildwachter
January 22, 2020, 2:21 AM

Wonder why they got rid of overrides, they don't seem very good at guessing (R->lisp, Python -> Swift, Docker -> awk, SQL, ...). Maybe it's better with longer scripts.

Jay Hodgson
January 22, 2020, 3:03 AM

You can still specify the language in highlight.js (see here), but during our transition of markdown processors we lost the functionality (moving that language string into the code element css class list). The automatic code detection definitely works better with more data. Do you want to open up another issue to re-introduce this feature into the new md processor code?

Xavier Schildwachter
January 23, 2020, 12:59 AM

Verified fixed.

Fixed

Assignee

Jay Hodgson

Reporter

James Eddy

Labels

None

Validator

Xavier Schildwachter

Development Area

None

Release Version History

None

Components

Sprint

None

Fix versions

Priority

Minor
Configure