forked from PrismJS/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
1f699e7
commit 76698cd
Showing
7 changed files
with
42 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"https://example.com" | ||
" /* not a comment */ " | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"https://example.com\""], | ||
["string", "\" /* not a comment */ \""] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for strings with comments. |