You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encode characters that are either reserved in HTML or XML, or are outside of the ASCII range.
default true
The description doesn't match the name: it literally says the decodeEntities option will "Encode characters".
This make it sound like the default behavior of the render function is to decode entities, when it fact the opposite is true: by default, it encodes the entities in the rendered HTML.
If you want it to encode the entities, you have to pass decodeEntities: true, which is pretty confusing as well.
This option probably should have been named encodeEntities?
The examples above and documentation would make more sense then:
Also, the description could be more accurate - it won't bypass the encoding of entities entirely, only for characters where this still produces HTML that can be parsed. As per my example, it will encode " no matter what.
I would suggest deprecating this option in favor of a correctly-named encodeEntities with the same behavior. (probably less confusing that changing the default and reversing the behavior, which would be a breaking change.)
The text was updated successfully, but these errors were encountered:
Either the name or the description of the
encodeEntities
option looks wrong for what it does:Per the inline documentation:
dom-serializer/src/index.ts
Lines 41 to 46 in 45e4123
And the README:
The description doesn't match the name: it literally says the decodeEntities option will "Encode characters".
This make it sound like the default behavior of the
render
function is to decode entities, when it fact the opposite is true: by default, it encodes the entities in the rendered HTML.If you want it to encode the entities, you have to pass
decodeEntities: true
, which is pretty confusing as well.This option probably should have been named
encodeEntities
?The examples above and documentation would make more sense then:
Also, the description could be more accurate - it won't bypass the encoding of entities entirely, only for characters where this still produces HTML that can be parsed. As per my example, it will encode
"
no matter what.I would suggest deprecating this option in favor of a correctly-named
encodeEntities
with the same behavior. (probably less confusing that changing the default and reversing the behavior, which would be a breaking change.)The text was updated successfully, but these errors were encountered: