-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
JavaScript highlighting should be improved #963
Comments
Please provide the entirety of the code you're trying to highlight. It seems to me that the initial highlighting problem occurs before this snippet. |
You're right. That single piece works better as standalone. import cluster from 'cluster'
import os from 'os'
const workers = os.cpus().length
cluster.setupMaster({ exec: 'app.js' })
function log(msg) {
console.log(`[SERVER] ${new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')} ${msg}`)
}
log(`Master with pid ${process.pid} starting...`)
for (let i = 0; i < workers; i++) {
cluster.fork()
}
cluster.on('exit', (worker, code, signal) => {
log(`worker with pid ${worker.process.pid} died. Restarting...`)
cluster.fork()
})
cluster.on('online', worker => {
log(`Worker with pid ${worker.process.pid} started`)
}) ^ GitHub's syntax highlighter has no problems |
@LeaVerou @zeitgeist87 Does it look safe to you to move up the template string pattern in the language definition of JS so that it's processed before normal strings? IMO it is much more common to encounter quotes inside template strings than backticks inside normal strings. What do you think? |
Agreed. |
If we move the delete Prism.languages.coffeescript['template-string']; Shall I commit my changes? |
Sounds good to me! |
Yup, agreed! |
It is more likely that single and double quotes appear in a template string, than backticks in a normal string. Fixes issue #963.
Should be fixed with [ |
I was about to test this (even if it's already a closed issue...) to report the status and how that code renders now, but i don't know how to install this with npm since this versions are published into gh-pages branch (uh?), and that is not released into npm, right? How i do install it then? |
For a quick test you can use http://prismjs.com/test.html or check out the gh-pages branch manually. The fix will be published to npm with the next release, which should be soon. |
this look much better now, thanks |
It still seems to be broken for backticks, try this:
|
JS highlighting fails too much, even at simple use cases. Example:
Most of it it's wrong. I wish i could provide a patch but i can just report it.
The text was updated successfully, but these errors were encountered: