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

HTML entities should be preserved #6

Closed
steadicat opened this issue Jul 27, 2016 · 0 comments · Fixed by #9
Closed

HTML entities should be preserved #6

steadicat opened this issue Jul 27, 2016 · 0 comments · Fixed by #9

Comments

@steadicat
Copy link

HTML entities (e.g. &) should be preserved in the output. This is especially important for entities that can mess up the HTML output if converted back into their corresponding character, such as <, >, and &:

gohtml.Format("<div>0 &lt; 1. great insight! &lt;/sarcasm&gt; over&amp;out.</div>")

gives:

<div>
    0 < 1. great insight! </sarcasm> over&out.
</div>

instead should be:

<div>
    0 &lt; 1. great insight! &lt;/sarcasm&gt; over&amp;out.
</div>
arandall pushed a commit to arandall/gohtml that referenced this issue Jan 30, 2018
The parser used the html.Tokenizer Text() function will return unescaped
text resulting in invalid HTML if HTML escaping is used in the input.

By using the Raw() function the text is preserved from the input and
does not remove escaping.

fixes yosssi#6
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

Successfully merging a pull request may close this issue.

1 participant