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

TypeScript syntax highlighting issue #119

Open
eric-schneider opened this issue Apr 3, 2024 · 1 comment
Open

TypeScript syntax highlighting issue #119

eric-schneider opened this issue Apr 3, 2024 · 1 comment
Labels
bug Something isn't working P1

Comments

@eric-schneider
Copy link
Contributor

Reported by @toptobes:

Syntax highlighting breaks when you have an immediately-invoked function expression (IIFE) that's an arrow function:

image (9)

Works fine with old-school function expressions:

image (10)

All I can say is that when making an IIFE using an arrow function, it renders the body of it improperly (as shown in the first image), But for some reason, renders properly when you declare an interface before it (so I'd imagine it might work if you declare a class or type before it? Haven't tested it yet though.)

image (8)

@eric-schneider eric-schneider added the bug Something isn't working label Apr 3, 2024
@eric-schneider
Copy link
Contributor Author

We use highlight.js for syntax highlighting. My guess is that this is an issue with the language definition itself (included in the core library): https://github.com/highlightjs/highlight.js/blob/main/src/languages/typescript.js

The highlight.js project maintains the core language definitions, so we should probably follow up by filing an issue. Alternatively, we can try and find a 3rd party TS definition and test whether it has the same highlighting issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1
Projects
None yet
Development

No branches or pull requests

1 participant