Full HTML edit mode shows HTML comments
MichaleR - November 30, 2008 - 12:06
I prefer to use Full HTML mode when creating content. And I like to embed comments in the HTML as notes to myself about the post or story.
However HTML comments, including the opening <!-- and closing --> display.
How can I change this behaviour?
Sample page showing the effect: http://www.vccb.us/html_comments

re: HTML Comment visible
Looking at the sample page referenced in your link, the HTML comment is visible because the 1st character of your HTML comment is not the "less than" character, it is the "entity" version of the "less than" character.
While it appears to be the "less than" character in the browser's display of the HTML comment, if you look at the "page source" ( Firefox or IE ) you will see the following:
<!-- this is in the HTML comment tag and should not disply --><br />instead of:
<!-- this is in the HTML comment tag and should not disply -->HTML Comments Visible
That's how they're being translated (presented?)
Yet when I created the page my typing in the edit box -- which was done with an input mode of Full HTML -- I didn't type in the entity. I typed in the
<!-- ... -->just like I typed in<p> </p>, <ul> <li> </li> </ul>...My underlying question is why Drupal is converting these html elements into displayable text when it parses formatting tags and creates a page with the desired formatting. Part of my desired formatting is to embed comments in the HTML.
I've updated the sample page to make explicit how the page was entered in the Drupal editor.
I wanted to leave messages
I wanted to leave messages to myself too (and other content editors), and posted about this issue a few days ago.
I wouldn't want auth users to be able to leave comments in the source (they could leave vulgar secret messages!), but it would be nice to be able to add the comment tag to the html filters based on role, and to be entirely left alone when the html filter is disabled (ie. full html input).
Perhaps this issue has something to do with the
<!-- break -->thing that drupal uses for page breaks?Switch to php mode and
Switch to php mode and problem goes away I think
> Switch to php mode and
> Switch to php mode and problem goes away I think
OK, but if you are leaving messages in the source for other editors, they
are very unlikely to have access to php mode. In fact, they're also unlikely
to have access to full html mode.
I think it would just be a nice solution to be able to have the comment tags added to the filter exception list.
How do we take this suggestion forward for D7?
HTML corrector filter is the problem...
The HTML corrector filter is 'entifying' the opening 'less than' character in the HTML comment .
HTML corrector is ON by default in Full HTML, but the HTML filter is OFF so the 'entified' comment is visible
HTML corrector is ON by default in Filtered HTML, but since the HTML filter is also ON, the 'entified' comment is removed
In PHP Evaluator, both HTML corrector and HTML filter are OFF by default, so the HTML comment is left "as is" and works as expected at the browser.
Please read these other issues / postings to put things in perspective:
http://drupal.org/node/222926
http://drupal.org/node/343236
Dave