Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
francislavoie opened this issue Sep 7, 2023 · 1 comment
Open

Comments

@francislavoie
Copy link

francislavoie commented Sep 7, 2023

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.

@francislavoie
Copy link
Author

TIL of the Developer: Inspect Editor Tokens and Scopes tool. Apparently it's being parsed as latex instead of javascript after the $ appears

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant