markdown-react-js icon indicating copy to clipboard operation
markdown-react-js copied to clipboard

Allow use of react inline styles on root component

Open davnicwil opened this issue 9 years ago • 7 comments

Adds a feature to pass a style prop to the root component, which is then applied as an inline style to the root html element.

Much the same idea as the className prop adding a class to the root html element, but for those who prefer using inline react styles to stylesheets.

Unit tests included, and for what it's worth have manually tested integration in a project - all works fine!

davnicwil avatar Jan 16 '16 22:01 davnicwil

Just to mention as well, on my fork I also have a branch 1.x, building on this, which upgrades to minimum peer dependency of react (and new react-dom package) 0.14.x

It doesn't add any functionality, but just gets everything lined up with react 0.14 (some tests fail due to slightly different markup, there are some warnings and deprecations which had to be cleaned up) and uses the stateless functional component feature of 0.14 which promises performance optimisations in future versions.

If you want I'll create a separate PR for this, after this one. Obviously it's a major version bump and breaking (dependency) change so, I'll do it however you'd prefer :-)

davnicwil avatar Jan 16 '16 22:01 davnicwil

Thank you for this! I don't have much time to deal with it right now, but I'll try to do it later (this lib needs some updates, including renaming). PR for 0.14 wouldn't hurt also :)

alexkuz avatar Jan 17 '16 11:01 alexkuz

No problem, have made the suggested changes but left the versioning as-was as I think a minor then a major bump, respectively for the two PRs, follows semver.

Have made the 0.14 PR :-)

davnicwil avatar Jan 17 '16 17:01 davnicwil

I just don't think PR is a good place for versioning. What if I already bumped a version?

Also, as far as I know, breaking change is when first non-zero version number changes, not just major version. So if major version is zero, 0.3.0 -> 0.4.0 would be a breaking change. (I'm not quite sure it's official, but I usually follow this rule; see for example https://docs.npmjs.com/misc/semver#caret-ranges-1-2-3-0-2-5-0-0-4)

alexkuz avatar Jan 18 '16 08:01 alexkuz

Good point - I'll roll the versions back in both PRs.

Re major and minor version numbers, I was following the definition from here http://semver.org/ I.e. the props thing is a backwards-compatible new feature, so minor bump, the react dependency change is a breaking change for at least a subset of consumers, so major bump.

Just as an aside, react itself does it sort of in the same way you describe, except they technically don't make breaking changes between subsequent minor bumps, just deprecations in the last minor version api - so it's a bit of a grey area. Anyway I'll roll the versioning back, it's your call :-)

davnicwil avatar Jan 18 '16 14:01 davnicwil

Yeah, I saw that, it just says "Major version zero (0.y.z) is for initial development. Anything may change at any time", so it's like anything might be breaking. But I like that "0.breaking.feature" / "breaking.feature.fix" scheme, it feels reasonable enough for me.

Thank you for cooperation! :)

alexkuz avatar Jan 18 '16 16:01 alexkuz

@davnicwil we got a merge conflicts, sorry! Can you please rebase?

kof avatar Oct 18 '17 14:10 kof