Skip to content

Script tag fails to highlight as JS if contents start with $ #148

@francislavoie

Description

@francislavoie

For example, the below fails to highlight correctly (detected as the wrong language?):

image

A workaround involves prefixing $ with window. which avoids $ at the start of the line which seems to disambiguate it:

image

Using <script type="text/javascript"> doesn't help either, FWIW.

Works fine with GitHub's syntax highlighter:

<script>
$('foo');
// This should be a comment
</script>

For context: we sprinkle a bit of <script> with some jQuery in our markdown docs to make some surgical adjustments to the markdown output, including linkifying some text in <code> blocks and such.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions