wooorm / refractor

Lightweight, robust, elegant virtual syntax highlighting using Prism
MIT License
724 stars 34 forks source link

Unexpected php highlight #23

Closed dancerphil closed 5 years ago

dancerphil commented 5 years ago

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

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

wooorm commented 5 years ago

Seems to be related to placeholders:

https://github.com/wooorm/refractor/blob/48d2d90423f60cbb28c0779d6f85ec560ce572b6/lang/php.js#L121-L129

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

wooorm commented 5 years ago

I tracked this down to css-extras:

https://github.com/wooorm/refractor/blob/32c65ffb2dea82f848cf675bdb689dcd09021e49/lang/css-extras.js#L79

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!

wooorm commented 5 years ago

I raised https://github.com/PrismJS/prism/issues/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!