Giter VIP home page Giter VIP logo

html2react's People

Contributors

deschtex avatar gfx avatar olofd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

html2react's Issues

Issue with background-image css property?

Hello - Thank you for creating this solution. It is very helpful. One thing I noticed is that the URL for the background-image property does not properly convert. For example the following HTML:

<td style="background-position:center; background-position:top; background-image: url('https://s3.amazonaws.com/preferably-dev/templates/images/bg_desktop.png');">
converts to:

<td style="background-position:center; background-position:top; background-image: url('https');">

Do you know if this is expected/part of react validation or some other dependency?

Thanks.

Brian

Add support for setting global element overrides

It would be nice to be able to set a list of default/global element overrides, so that one does not have to repeat the overrides for recurring conversions. Example:

import HTML2React from 'html2react'
import Link from './components/Link'

HTML2React.setGlobalElementOverrides({
  'a.external': (props) => (
    <Link external {...props} />
  )
})

element after <figure> is removed

Hello,

I have been html2react with some content and i discovered that first dom node after figure element is ignored.
Fore example if i have two paragraphs (p) after figure element, only the second one is returned.

Any ideas?

All the best
Hembo

Support for React v18

Hi,

Thanks a lot for this lib!

Are you planning on releasing a version for React v18?

Thanks,

What do you think of having a "curried" API?

It could look like this:

const reactifier = html2react({ a: Link })

const reactComponents = reactifier(content)

for the regular API it would imply only reverting the order of the arguments:

const reactComponents = html2react({
  a: Link
}, content)

This way it's easy to provide a common wrapping when makes sense to use the same setup in multiple places.

Allow for more advanced override selectors

Currently it is only possible to use simple selectors such as type selectors (p), attribute selectors ([attr]), class selectors (.class), ID selectors (#id), etc.

It's not possible to do more advanced selectors such as descendant selectors (div p), child selectors (div > p), adjacent sibling selectors (h1 + p) and pseudo-class selectors (p:first-child, p:nth-child(3)).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.