highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

Explain the difference between php and php-template in their comments

Open alexeyinkin opened this issue 1 year ago • 1 comments

Both php and php-template only have the link to https://www.php.net in their header comments. How does one choose one over another?

  • The discussion was here: https://github.com/highlightjs/highlight.js/issues/2330

And it is unclear how it ended.

I believe that those two languages should have a short comments in headers like

Choose this for any PHP code, with the opening tag or not.

or

Choose this for PHP code with a required opening tag.

(If I got the difference right.)

alexeyinkin avatar Apr 25 '23 08:04 alexeyinkin

The last option is what we ended up with:

  • PHP templates are detected as php-template
  • Raw php code (snippets) are detected as php

So print("blah") might be php while <?php print("blah") ?> would be a php-template. I think an additional comment to explain in those files would be reasonable.

joshgoebel avatar Apr 25 '23 23:04 joshgoebel