Skip to content
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

PHP Comment with <element> inside #197

Closed
mavimo opened this issue Dec 28, 2013 · 3 comments
Closed

PHP Comment with <element> inside #197

mavimo opened this issue Dec 28, 2013 · 3 comments

Comments

@mavimo
Copy link
Contributor

mavimo commented Dec 28, 2013

There is some issue on syntax highlight in PHP

/**
 * A standard comment.
 */

/**
 * Another comment with broken syntax highlight
 *
 * @author Marco Vito Moscaritolo <marco@mavimo.org>
 */

In test drive, when you enable PHP there is an issue that do not display the second item as comment. Clike syntax work fine.

After some debugging seam to be an issue related to markup, if I add a && false at line 40 of prism-php.js the syntax highlight work fine.

@mavimo
Copy link
Contributor Author

mavimo commented Dec 28, 2013

Problem is related on line 80 of prism-php.js, using:

Prism.languages.insertBefore('php', 'keyword', {
  'markup': {
    pattern: /a^/g,
    inside: Prism.languages.markup
  }
});

temporary solve the issue.

@milesj
Copy link
Contributor

milesj commented Dec 28, 2013

Do your changes still work well when mixing HTML and PHP?

@foo123
Copy link

foo123 commented Jan 7, 2014

Hi take a look at this prism plugin:

https://github.com/foo123/prism-grammar

User can define a JSON grammar (quite flexibly) to be used for prism for a specific language

PS i am the author

@Golmote Golmote closed this as completed in 318aab3 Jul 5, 2016
zeitgeist87 added a commit to zeitgeist87/prism that referenced this issue Feb 10, 2017
This patch is an attempt to fix the PHP language, when it is combined
with markup.

The problem is, that markup has a higher priority than all other tokens.
This leads to weird errors, where HTML tags are highlighted inside of
comments PrismJS#197. One solution to this was to set the `greedy` flag for the
comment token, but this leads to far worse errors like PrismJS#1097.

This patch should fix both issues PrismJS#197 and PrismJS#1097, by switching the
grammar to markup on the fly. One potential problem is, that it relies
on the `<?php` tag to detect if markup is present. So if a PHP file
contains only markup and no PHP code at all, the result will look
broken.
zeitgeist87 added a commit to zeitgeist87/prism that referenced this issue Feb 11, 2017
This patch is an attempt to fix the PHP language, when it is combined
with markup.

The problem is, that markup has a higher priority than all other tokens.
This leads to weird errors, where HTML tags are highlighted inside of
comments PrismJS#197. One solution to this was to set the `greedy` flag for the
comment token, but this leads to far worse errors like PrismJS#1097.

This patch should fix both issues PrismJS#197 and PrismJS#1097, by switching the
grammar to markup on the fly. One potential problem is, that it relies
on the `<?php` tag to detect if markup is present. So if a PHP file
contains only markup and no PHP code at all, the result will look
broken.
zeitgeist87 added a commit to zeitgeist87/prism that referenced this issue Mar 10, 2017
This patch is an attempt to fix the PHP language, when it is combined
with markup.

The problem is, that markup has a higher priority than all other tokens.
This leads to weird errors, where HTML tags are highlighted inside of
comments PrismJS#197. One solution to this was to set the `greedy` flag for the
comment token, but this leads to far worse errors like PrismJS#1097.

This patch should fix both issues PrismJS#197 and PrismJS#1097, by switching the
grammar to markup on the fly. One potential problem is, that it relies
on the `<?php` tag to detect if markup is present. So if a PHP file
contains only markup and no PHP code at all, the result will look
broken.
zeitgeist87 added a commit to zeitgeist87/prism that referenced this issue May 8, 2017
This patch is an attempt to fix the PHP language, when it is combined
with markup.

The problem is, that markup has a higher priority than all other tokens.
This leads to weird errors, where HTML tags are highlighted inside of
comments PrismJS#197. One solution to this was to set the `greedy` flag for the
comment token, but this leads to far worse errors like PrismJS#1097.

This patch should fix both issues PrismJS#197 and PrismJS#1097, by switching the
grammar to markup on the fly. One potential problem is, that it relies
on the `<?php` tag to detect if markup is present. So if a PHP file
contains only markup and no PHP code at all, the result will look
broken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants