Replies: 1 comment
-
Because this project is not straightforward, here's a bit simplified version of it: import React from "react";
import Editor from "~/lib/Editor";
import { highlight, languages } from "prismjs/components/prism-core";
import "prismjs/components/prism-clike";
import "prismjs/components/prism-javascript";
import "prismjs/themes/prism.css"; //Example style, you can use another
export default function App() {
const [code, setCode] = React.useState(
`function add(a, b) {\n return a + b;\n}`
);
return (
<Editor
value={code}
onValueChange={(code) => setCode(code)}
highlight={(code) => highlight(code, languages.js)}
padding={10}
style={{
fontFamily: '"Fira code", "Fira Mono", monospace',
fontSize: 12,
}}
/>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have this project with CRA: https://github.com/arvigeus/format-code (Demo)
I try to transfer it to Remix, but PrismJs is not playing well (complains of not being defined): https://github.com/arvigeus/format-code/tree/remix
Why is this difference? Bug in Remix, or I am doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions