The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Has anyone got the "comment" tags to work in a published Canvas Page? Every time I add a comment <!-- Comment here --> to the page and publish it, Canvas wipes my code out.
Solved! Go to Solution.
@chris_slupianek , the rule of thumb in the HTML Editor is that if you're using a tag that is not listed in the Canvas HTML Editor Whitelist, it will get stripped out. I know we've had specific questions in the past about the "comment" tag, which definitely doesn't stick.
Update -
If you use
<div style="display: none;">
</div>
instead of <span...
then it appears to be persistent. Info found here: Re: Aceptable HTML Elements
@chris_slupianek , the rule of thumb in the HTML Editor is that if you're using a tag that is not listed in the Canvas HTML Editor Whitelist, it will get stripped out. I know we've had specific questions in the past about the "comment" tag, which definitely doesn't stick.
Since an HTML comment isn't an HTML element , an allowlist of elements doesn't actually address whether comments are allowed. (And there is no security reason I am aware of that they should be stripped, so it seems odd that they're stripped.)
I'm also working on a related problem, which is that although the src attribute for an img element is in the allowlist, the HTML editor strips out the entire attribute when a data URL is used. Again, it's difficult to see why this poses a security risk, since external URL references can deliver the same payload.
Edited to add - use <div> rather than <span>
There is a bit of a workaround although it is not ideal.
Click to edit the page and then click on HTML Editor.
Surround the text to be hidden with:
<span style="display:none;">
</span>
Then save without returning to the Rich Text Editor.
The reason that it is not ideal is that when you go in to the Rich Text Editor it will strip the tags out, so the next time you edit you will lose them (as edit always starts up in RTE as far as I know).
Update -
If you use
<div style="display: none;">
</div>
instead of <span...
then it appears to be persistent. Info found here: Re: Aceptable HTML Elements
Well, what stinks is I just learned this the hard way. It not only strips out the comment tags but *everything* that was between them too. Thanks a lot.
I can't believe that after 6 years that this is still an issue...grr
I hate the workaround...
<div style="display: none;">
<p>-------------- // START ROW #1 // --------------</p>
</div>
That and my **bleep** code has to deal with foreign characters being made into &crap;
+1 request to allow HTML comments.
The links to the whitelist HTML pages in this thread are broken.
@JillRho's workaround works.
Good evening, @james_neill ...
The HTML allow list can be found in the blue box at the top of this Guide: How do I use the HTML view in the Rich Content Edi... - Instructure Community (canvaslms.com).
Also, if you would like to see this element added to the HTML allow list, then you could certainly submit this as a Feature Idea request. Here are some documents for you to look through:
Hopefully these links will be of some help to you.
I just lost a week of work the hard way. The HTML tag should be OK to use WW3 has it. It is not deprecated. It is valuable and in wide use in other HTML applications. This should be changed so that code is not wiped out. I did not know this was a problem until I lost all my planning for the next month. I use tables to create a calendar and the students were getting confused, so I commented out the parts of the table I did not want them to see. So I lost all of it for the next 4 to 5 weeks.
So I learned the hard way.
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.