Skip to content
This repository was archived by the owner on Nov 3, 2019. It is now read-only.

Fix parsing complex style props #172

Merged
ChristopherBiscardi merged 5 commits into
ChristopherBiscardi:masterfrom
danielberndt:new-html-to-jsx
Nov 12, 2018
Merged

Fix parsing complex style props #172
ChristopherBiscardi merged 5 commits into
ChristopherBiscardi:masterfrom
danielberndt:new-html-to-jsx

Conversation

@danielberndt

Copy link
Copy Markdown
Contributor

the version of htmltojsx that is being used has an issue with the style prop that is being output by gatsby-remark-images:

style="padding-bottom: 75%; position: relative; bottom: 0; left: 0; background-size: cover; display: block; background-image: url('data:image/jpeg;base64,/9j/2w[...]1XP//Z');"

It struggles with the semicolon within the url() part.

Since there haven't been any releases of htmltojsx in a long time, I'm not too certain my PR will be merged and released anytime soon. So I published a fork which fixes the issue.

This PR basically replaces the old htmltojsx with my fork.

@ChristopherBiscardi

Copy link
Copy Markdown
Owner

hey @danielberndt, thanks for this. I'll likely get to reviewing/merging early this week. Are you planning on maintaining htmltojsx going forward or should we look at incorporating the new code in the repo here instead?

@danielberndt

danielberndt commented Oct 15, 2018

Copy link
Copy Markdown
Contributor Author

No, I don't think I can guarantee maintaining this fork. So I'd consider this to be a temporary fix only.

So I think that somehow incorporating that piece would be a smarter move. And I guess that using something like rehype might make it fairly straight forward.

In my research I also found this file from the mdx package which might help. Note that it's using to-style for transforming the css, which unfortunately also fails to correctly convert the output of gatsby-remark-image.

@ChristopherBiscardi

Copy link
Copy Markdown
Owner

merging this since it can't really make the html/jsx situation worse, but we really need a better solution to this problem of gatsby plugins inserting raw html that needs to be converted to JSX. (note: it doesn't look like the other PRs for htmltojsx are anywhere near being merged, etc)

Thanks for the PR @danielberndt

@ChristopherBiscardi ChristopherBiscardi merged commit 5b534a5 into ChristopherBiscardi:master Nov 12, 2018
@ChristopherBiscardi

Copy link
Copy Markdown
Owner

meh, looks like this is causing warnings in the console. going to investigate trying to run https://www.npmjs.com/package/@mapbox/hast-util-to-jsx in a loop on html fragments

image

ChristopherBiscardi pushed a commit that referenced this pull request Jun 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants