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

States are rendered as attributes - HTML #244

Open
zpokoin opened this issue Apr 11, 2019 · 4 comments
Open

States are rendered as attributes - HTML #244

zpokoin opened this issue Apr 11, 2019 · 4 comments

Comments

@zpokoin
Copy link

zpokoin commented Apr 11, 2019

So here's the html I have added. For the disabled state, and checked state, it automatically adds the equal signs and quotations.

Is there a way to remove on for those states?

image

image

@ccampbell
Copy link
Owner

I think this has to do with the browser treating it as html. Rainbow shouldn’t add anything itself.

For HTML highlighting you have to use HTML entities. Try replacing < with &lt; and > with &gt;.

@joshgoebel
Copy link

@ccampbell Is there a reason you don't encourage this (make it more obvious) by using textContent or innerText instead of innerHTML? See my concerns on the thread I started on security concerns and users confused about this very topic.

Have we worked on anything before? Your name/avatar looks a little familiar.

@LucaGabi
Copy link

LucaGabi commented May 23, 2021

If you call innerText is the html preserved ?

would it not be better to just replace tags with &lt; &gt; ?

@joshgoebel
Copy link

Version 11 of Highlight.js logs an error to the console in this situation and purposely strips all HTML (instead of rewriting it and merging it back as version 10 did). This is dangerous and should only be done by those who for sure know they want this behavior - and if so it can be added back with a plugin and option to turn off the security warning.

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

4 participants