PrismJS / prism

Lightweight, robust, elegant syntax highlighting.
https://prismjs.com
MIT License
12.35k stars 1.29k forks source link

Latte highlighting bug #2592

Open RunDevelopment opened 4 years ago

RunDevelopment commented 4 years ago

Description As discussed here, after some improvements to PHP, Latte no longer passes its tests. This is because Latte-type call expressions are highlighted with PHP.

Example Latte tests.

<a n:href="Post:show $post->id">link</a>
RunDevelopment commented 4 years ago

@dg Can you help with this? A link to a detailed explanation of this syntax would be enough for me to fix it.

dg commented 4 years ago

In Latte is in some cases possible to omit quotation marks around strings, specifically it is the case of first characters before [\s,], ie. Post:show. So it is string.

But despite that, the syntax highlighting looks visually better when it's not taken as a string, ie. https://doc.nette.org/en/3.0/creating-links#toc-in-the-presenter-template, so I think that these changes are ok https://github.com/PrismJS/prism/pull/2566/commits/2f0b21eb5a00a81cc592323c7f8f1ded18d9efb7#diff-7341ff08c4d814cbbb6e99cffe0347a2a53a5a683d498514358f5ebb34c732ec

RunDevelopment commented 4 years ago

Thank you for the explanation.

2591 will change the highlighting again, so I'll look for a solution after that. You're definitely right that it looks better not being a string, so I'll take that into account.