-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Necessary HTML tags and attributes for Trix #129
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
Comments
Bumping this again because today I discovered that strike-through doesn't work on my site because I didn't know to whitelist it. |
would this issue be the right place to request the possibility to add the target="_blank" attr to the < a > tag? |
@nimi09 see #55 (comment) |
This is what I use for sanitization. So in general only attachments are more complex. |
Oh, good call. I guess a code version of my sanitization (and adding |
Bumping again because headers didn't work after I upgraded. |
We don't plan to maintain a running list of tag names. You see the tags used for formatting attributes in https://github.com/basecamp/trix/blob/master/src/trix/config/text_attributes.coffee and https://github.com/basecamp/trix/blob/master/src/trix/config/block_attributes.coffee. |
According to #121, sanitizing HTML is the responsibility of the code that passes the HTML to Trix. So it would be great if there were a list of tags & attributes that Trix needs in order to work, so that people know what HTML to allow in their sanitization step.
This is the list of tags and attributes I had to allow in my HTML sanitizer (in addition to the defaults) for Trix to work:
data-trix-attachment
on<a>
tags<figure>
tagsclass
on<figure>
tags<figcaption>
tagsclass
on<figcaption>
tags<img>
tagswidth
andheight
on<img>
tags<span>
tagsclass
on<span>
tagsIf you change those or add new ones in future releases, I have to manually figure out what new tags and attributes to add to my whitelist. The only way I know to do that is by trying every Trix feature and looking at which ones don't seem to work.
The text was updated successfully, but these errors were encountered: