Closed AniruddhaTupe closed 6 months ago
<CodeMirror
value={code}
options={{
+ theme: "monokai",
mode: 'python',
}}
/>
I copied the exact same example code, but still I can't see syntax highlighting.
Following are the sequence of npm commands I executed if that helps - npx create-react-app code-autograder npm install npm install codemirror@5 npm install @uiw/react-codemirror
Also attaching the file structure -
And attaching the output -
Ok, it's resolved now.
Had to run npm i @codemirror/lang-python
And then import it -
import { python } from '@codemirror/lang-python';
And then use it -
extensions={[python()]}
I'm developing a code editor for Python. But I'm unable to get the syntax highlighting to work.
Following is my code -
And following is the output -