-
Notifications
You must be signed in to change notification settings - Fork 262
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
Codemirror syntax highlighting doesn't seem to work #34
Comments
up |
Yup, even I'm not getting it. |
Are you using it with weback? |
Thanks for the response. Yeah, I am using Webpack. I'll look into it and if I figure anything out, I'll post a note :) |
Actually, I've got it working. In my case, it was because I was specifying mode as |
I had the same/similar issue, which was resolved by upgrading to npm 3. I've got Under npm 2, I had 2 copies of |
I'm using webpack and npm 3.3, this is how I got syntaxhighlight to work: |
I had originally installed react-codemirror without codemirror (so code-mirror installed as a dependency), and syntax highlighting didn't work. This worked for me:
This way codemirror isn't installed also as a dependency under react-codemirror that may have slight version differences. Also noted I ended up with a newer codemirror (5.14.2), which could also have an impact. |
Webpack and npm 2.14.12. import Codemirror from 'react-codemirror'
import 'react-codemirror/node_modules/codemirror/mode/jsx/jsx'
import 'react-codemirror/node_modules/codemirror/lib/codemirror.css' |
Do anyone encounter similar issue?
What I get in the result, is there something I missing?: |
I get this problem too. |
Building on what @bengle said, this worked for me: import '../node_modules/codemirror/mode/javascript/javascript.js'; |
I'm still facing the same problem using even with all the solutions and the original CodeMirror, npm v4.1.12 I'm running the app in development server with hot realoading and nothing seems to work. The actual markdown.js file is being imported and it runs but it still doesn't work. Since I'm facing the same problem even after replacing react-codemirror with the vanilla CodeMirror instance, I believe this must be something related to Webpack itself. |
@fooqri 's solution worked for me. thanks! cheers. |
Here is my solution to fix this problem.
Version:
Code:
May help you~ |
I just wanted to resurrected this topic, I was suffering with this too. I wanted to share my solution to save the fellas as much as possible. I added those lines and it is solved.
Editor initializing:
|
@lancejpollard Hi! Did you solve this problem? Same here :( upd: Updating |
First of all, thanks for putting the work into making CodeMirror work with React. I have it working great EXCEPT the syntax highlighting just doesn't work. I included the necessary library modes (ie: Javascript, PHP) and theme but the Syntax doesn't get highlighted. When I view the live DOM, I don't see any of the markdown that triggers the syntax colors (like cm-tag, etc...). Has anyone else experienced this?
The text was updated successfully, but these errors were encountered: