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

Double slashes in PHP strings #1097

Closed
ethanhowell opened this issue Feb 9, 2017 · 2 comments
Closed

Double slashes in PHP strings #1097

ethanhowell opened this issue Feb 9, 2017 · 2 comments

Comments

@ethanhowell
Copy link

If I have two backslashes in a php string, Prism will mark the rest of the line as a comment.
example

@zeitgeist87
Copy link
Collaborator

zeitgeist87 commented Feb 9, 2017

Thanks for reporting this. This is definitely a bug.

The problem is, that the greedy flag is set on the comment token. Comments are always highlighted first, so there seems to be no reason for the flag there. I suspect, that it was put there to fix some other issue.

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.
@zeitgeist87
Copy link
Collaborator

This issue should be fixed by #1100

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants