Skip to content

Commit

Permalink
website: add example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 12, 2024
1 parent c3d2efa commit 624e0f1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,35 @@ export default function App() {
}
```
## Show LineNumbers
```jsx
import rehypePrism from 'rehype-prism-plus';
import React, { useState } from "react";
import CodeEditor from '@uiw/react-textarea-code-editor';

export default function App() {
const [code, setCode] = useState(
`function add(a, b) {\n return a + b;\n}`
);
return (
<CodeEditor
value={code}
language="js"
placeholder="Please enter JS code."
onChange={(evn) => setCode(evn.target.value)}
rehypePlugins={[
[rehypePrism, { ignoreMissing: true, showLineNumbers: true }]
]}
style={{
backgroundColor: "#f5f5f5",
fontFamily: 'ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace',
}}
/>
);
}
```
## Support Nextjs
Use examples in nextjs. [#31](https://github.com/uiwjs/react-textarea-code-editor/issues/31#issuecomment-909363339)
Expand Down

0 comments on commit 624e0f1

Please sign in to comment.