-
Notifications
You must be signed in to change notification settings - Fork 94
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
Possible bug in the readme example (entityToHTML) #179
Comments
Experienced this recently. @Nasicus Your workaround works, thank you! Yet, this makes me a little uncomfortable since I'm unsure why this works the way it does. Is there any way to not encode |
I looked into why this works and let me see if I understand it: In When that is converted to HTML, the above is only used to generate the tags (line 35 draft-convert/src/blockEntities.js Line 35 in 1b78ab1
In line 36 ( draft-convert/src/blockEntities.js Line 36 in 1b78ab1
getElementHTML is called with originalText which actually ends up being used as the child node of a tag:
|
@karldanninger @hgezim The only thing I'm a little afraid is that the suddenly change this in the future ;) |
The readme has the following example:
This works fine, however the originalText appears to be already HTML encoded and therefore if it contains special characters like an
'
it will be double encoded.E.g.
originalText
=my'url
will result in the HTML<a href="https://google.ch">my&#x27;url</a>
As a workaround I changed the function to that:
Now the resulting HTML will be
<a href="https://google.ch">my'url</a>
(because of the way thegetElementHTML
function works).Not sure if this workaround is correct and can be used like this but it appears to work. I guess if the
getElementHTML
will never change I can leave my workaround...Also not sure if I'm doing something wrong or if this is an actual bug.
The text was updated successfully, but these errors were encountered: