These are not sufficient to escape strings embedded in comments.
Character | Entity | escape_text
| escape_attribute
| escape_all_quotes
----------|----------|---------------|--------------------|--------------------
&
| &
| ✔ | ✔ | ✔
<
| <
| ✔ | ✔ | ✔
>
| >
| ✔ | ✔ | ✔
"
| "
| | ✔ | ✔
'
| '
| | | ✔
escape_text(string) -> String
Escape a string so that it can be embedded in the main text. This does not escape quotes at all.
escape_attribute(string) -> String
Escape a string so that it can be embedded in an attribute. Always use double quotes around attributes.
escape_all_quotes(string) -> String
Escape a string including both single and double quotes. In general you should not need to use this.
unescape(string) -> String
This follows the [official WHATWG algorithm] for expanding entities. The only exception should be that entities are supposed to be expanded slightly differently when they are in the main body of the text as opposed to within an attribute.
This project dual-licensed under the Apache 2 and MIT licenses. You may choose to use either.
Unless you explicitly state otherwise, any contribution you submit as defined in the Apache 2.0 license shall be dual licensed as above, without any additional terms or conditions.