HLJS language autodetection / syntax highlighting fails

  1. Summary: Autodetection of language for syntax highlighting does not happen, the language seems to be automatically detected based on the extension of the file.
  2. Steps to reproduce: Create a snippet of valid MATLAB code, for which the filename ends with the .m extension : see this snippet https://gitlab.com/snippets/2097
  3. Expected behavior: highlight.js should be able to autodetect the language itself (this is normally the value added by this library), but this behavior seems to be impeded by an automatic override in the source code based only on the file extension. (see comment on commit 0d13abb1). See following snippet for correct syntax highlighting when the extension is changed to .matlab : https://gitlab.com/snippets/2118
  4. Observed behavior: see https://gitlab.com/snippets/2097
  5. Relevant logs and/or screenshots: see snippets above, and the two screenshots in the comments below.
  6. Output of checks
    • Version of GitLab: GitLab 7.3.2 f092e53e
    • Setup: vanilla Omnibus install on Debian 7
  7. Possible fixes: see comment here: https://gitlab.com/gitlab-org/gitlab-ce/commit/0d13abb1c8d527f2a6e6b97e34899e9b35f264bc#note_301722
Assignee Loading
Time tracking Loading