wooorm / refractor

Lightweight, robust, elegant virtual syntax highlighting using Prism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected php highlight

dancerphil opened this issue · comments

The result of refractor.highlight(...) is unexpected.

see demo: https://codesandbox.io/s/unexpected-php-highlight-9x2u4

commented

Seems to be related to placeholders:

refractor/lang/php.js

Lines 121 to 129 in 48d2d90

Prism.languages['markup-templating'].buildPlaceholders(
env,
'php',
phpPattern
)
})
Prism.hooks.add('after-tokenize', function(env) {
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php')
})

Not sure if we can fix the after-tokenize phase.

commented

I tracked this down to css-extras:

number: /-?[\d.]+/

And I can reproduce it with normal Prism as well:

Screenshot 2019-08-01 at 4 40 27 pm

I’ll raise an issue there!

commented

I raised PrismJS/prism#2008.
As this is an issue there, I don’t think it’s needed to keep it open here.
Follow their issue for updates, and when there’s a fix released, it’ll be pulled into refractor!