-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Prism seems to not highlight HTML comments (at least when I tried it) #2651
Comments
Prism only highlights the text content of |
Thanx a lot for the quick tip and answer! It finally worked once I've escaped all |
Something what still bothers me, even if the Unescaped markup plugin is used: What is the reason for naming the class It won't till a so called plugin "unescaped markup" is used - BUT HERE COMES THE CAVEAT: you can't use You can only use it in a weired combination like here: http://jsfiddle.net/neohiro79/zbfdhxjy/2/ >> @edit that point is solved - I forgot to escape the html entities. It also puts some sort of weired additional 'tabspace' before the 'style' tags for some reason. see here: http://jsfiddle.net/neohiro79/zbfdhxjy/3/ >> @edit that point is solved, too. I used tabs instead of spaces. Still, this question remains unsolved:If this markup-plugin can realise the specific Am I the only one who wants to use and see comments in HTML code snippets? |
Markup inside of Unescaped Markup (UM) only works because it uses markup elements (comments and plain text script tags) that don't have side effects.
I don't know what you mean by that.
Because there is no magic. UM will only be active for
Most certainly not. We get an issue like this every month or so and the answer is always the same: Escape your |
Allright, I get it. Seems like Browser Vendors have f* up broadly. Why the f* hell javascript itself is beeing executed once inside a code tag ??? This should NOT be the case - I mean what is the reason for putting things in a code tag, for sure NOT code execution. But anyway, since it is like that, I seem to have to accept it. Why bothering searching for a meaning ...
I meant exactly this - if I use
I don't get that. However, what I still don't get is why are "comments" seen as malicious either? There cannot be any 'malicious' part in comments since they for sure won't execute - or am I wrong even in this case? Can't the 'comment' class accept at least what it implies? Accepting comments? |
I don't think so. HTML parsing rules are already complex enough, so parsing markup inside Also, let's keep the discussion civil, please.
That's not what
Don't worry, comments aren't seen as malicious and won't be executing anything either. In the case of comments, UM is only active for
A |
I knew that already, my point is if there is a "hinting" class for Prism to know which language to expect, and there is a generic name like "markup" instead of say "html". I understand it as a "container-class" for "html, css and javascript". At least that's what I would expect. I was irritated that it didn't seem to work in Prism.js as I would expect, since it worked properly in Rainbow.js, as shown here: It's class And yes, I know, there have been "security-concerns" about this usecase about working without escaping, but personally that's what I expected at that point in time. Now, Prism.js seems to work 'similar', but you need to know to PROPER ESCAPE and use the classname "language-markup", which also results in what I wanted to have: So basically, I am happy now - but as said, you need to know the PROPER ESCAPING PRACTISE, else you will see all kind of weird errors in the syntax highlighting, which is really irritating and annoying if you are not expecting this kind of behaviour, since it is not extra pointed out in the manual as far as I am aware of. |
That's interesting that Rainbow.js uses
Prism is built on top of existing best practices. People already used Escaping certain characters is how HTML always used to be and, given that changing is behaviour will break the internet, most likely always will be.
I'll add a note. |
Since I've had a long and very interesting conversation with @joshgoebel (the maintainer of highlight.js) about this very topic, I also came to the conclusion, after understanding the whole problem, that it is not a good idea to use Since HTML see conclusion here: |
Just read through your discussion over there :) I'm sorry that I couldn't explain the issue as well as Josh did but I'm glad that we all came to an understanding. |
:-) yeah, he was very on point of the whole issue and finally convincing. |
You can see the problem in this JSFiddle here:
Is there something I've missed?
I even tried to give it a classname "comment" as proposed somewhere - but the HTML comments won't show up.
The text was updated successfully, but these errors were encountered: