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

Unexpected escaping #9

Open
tcoughlin3 opened this issue Jul 7, 2020 · 2 comments
Open

Unexpected escaping #9

tcoughlin3 opened this issue Jul 7, 2020 · 2 comments

Comments

@tcoughlin3
Copy link

Hi @hanford thanks for your work on this library. I was testing it out and I think I came across a bug. Not 100% sure what's going on but I think with the recursion the concatenated output string is hitting the default switch case and callling escapeHtml(children) 2 more times than needed.

When calling serialize({"children":[{"type":"p","children":[{"text":"& , \" < >"}]}]})...

Expected output: '&amp; &quot; &lt; &gt;'

Actual output: '&amp;amp;amp; , &amp;amp;quot; &amp;amp;lt; &amp;amp;gt;'

@hanford
Copy link
Owner

hanford commented Jul 12, 2020

@tcoughlin3 hmmm probably because of 497431b

I'd accept a PR that includes a fix (and a test!) if it's problematic for you

@dylans
Copy link
Contributor

dylans commented Feb 8, 2021

I'm not convinced this should be calling escaping html at all because it's supposed to be serializing ast to markdown, not html. Shouldn't it instead leave < > and & alone, and turn ' and " into ' and " instead?

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

No branches or pull requests

3 participants