React-styleguidist: JSX highlighting breaks on styleguidist example page

Created on 21 Sep 2017  路  12Comments  路  Source: styleguidist/react-styleguidist

See: https://react-styleguidist.js.org/examples/basic/#modal

Where is the highlighting?
ASameso in my project, it fails when I do:

```jsx
\ full={false}
inactive={false}
align=\'left\'>hoi<\/Button>
```

I also put in styleguide.config.js:
module.exports = { highlightTheme: 'material', // etc }

  • Webpack version: "webpack": "^3.5.6",
bug

All 12 comments

Where is the highlighting?

I assume it tries to catch last warm days and having a short break from work.

I鈥檝e seen this couple of times and was able to fix by updating all Styleguidist dependencies. But honestly I have no idea why it is happening. Feel free to send a pull request with a fix ;-)

module.exports = { highlightTheme: 'material', // etc }

Theme is not an issue, Codemirror doesn鈥檛 highlight code at all for some very obscure reason.

Similar issue: #105.

And one more at react-codemirror2: https://github.com/scniro/react-codemirror2/issues/7

The issue seems to be because Styleguidist and react-codemirror2 have a codemirror dependency and when we import modes webpack somehow loads them from a different codemirror.

This works fine, but it鈥檚 a huge hack:

- import 'codemirror/mode/jsx/jsx';
+ import 'react-codemirror2/node_modules/codemirror/mode/jsx/jsx';

The proper fix would be moving codemirror to peerDependencies in react-codemirror2. @scniro What do you think?

That works! react-codemirror2 doesnt work with latest codemirror apparently

I think it doesn鈥檛 work when we use two different versions.

@sapegin yes you are correct on the versioning conflict - this actually happened with another user on the last release 5.29.0 release of CodeMirror as well. I am unsure why the conflict causes the loss of highlighting - it's the only noticeable side effect I have found.

Anyways, I did have the versioning too strict. I pushed up 1.1.0 which should resolve this issue for you. Please keep me posted with your findings!

@scniro Thanks! Right now peerDependency doesn鈥檛 do anything:

https://github.com/scniro/react-codemirror2/blob/3e0be8dc7556c169cac36df91572265830fcaf56/package.json#L34-L40

It鈥檚 either dependency or peerDependency.

Hey all, please pull 2.0.0 instead. I overlooked the breaking changes that would result from users that did not already have any version of codemirror as a dep. See https://github.com/scniro/react-codemirror2/issues/12. Prior 1.x releases have been unpublished in favor of moving forward with 2.x. Thanks

@scniro It works, thanks!

Expect a new release in 10 minutes ;-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mealeyst picture mealeyst  路  3Comments

mheathcote1977 picture mheathcote1977  路  3Comments

eduardoinnorway picture eduardoinnorway  路  3Comments

vchoisk picture vchoisk  路  3Comments

gargroh picture gargroh  路  3Comments