-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
HTML comments stripped? #263
Comments
I'm seing the same -- all HTML comments are deleted from the output. And it's clearly a bug because it breaks real-world websites on old IE's. IE Conditional comments are the de-facto way of allowing IE8 to render both HTML5 tags and and responsive CSS. For the use case of non-output comments, I assume a Go comment in a template tag could be used instead? :
|
Unfortunately I'm not sure this is going to be an easy fix. The Go html/template package purposefully strips comments. You can see a discussion of this here I think in the meantime you can work around this by using something like::
|
@spf13 would you welcome a PR that added more escaping options? Something like a |
Yes. Please also add documentation for using them. On Wednesday, May 21, 2014, Aaron Boushley notifications@github.com wrote:
Steve Francia |
I can confirm that the safeHtml solution by @boushley works. Maybe documenting that workaround is the safest and quickest solution... |
I agree that we should add documentation for this. @jesper-mortensen or @boushley, would either of you like to add it, since you've been successfully using it? |
What can I do if I don't want comments stripped out? |
Has this changed? I'm now seeing comments in my HTML output. |
@dimo414 I'm not aware of any changes made to the Go template library. What version of Hugo are you using? What Go is it built with? |
I'm using Hugo 0.15, via the
|
Okay so I just discovered that the current state of things is that comments are stripped from template files, but not stripped from content files. |
@spf13 is this desired functionality? Could comments be stripped from content files as well? |
@dimo414 as far as I can se Hugo uses the blackfriday for markdown rendering. From looking at its documentation it does not provide an option to strip comments, as it probably just treats them like inline HTML. |
A note for onlookers, |
@ernsheong thanks for your last comment. It saved me time and stress. Really appreciated it. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Are HTML comments stripped by Hugo during rendering?
It's not that I mind so much to remove comments, but for conditional comments, this can be annoying... Don't know if it's a bug, or a feature.
Becomes:
:-)
Thanks,
Jérémy
The text was updated successfully, but these errors were encountered: