https://github.com/phartenfeller/react-readonly-codemirror6
https://github.com/phartenfeller/react-readonly-codemirror6
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/phartenfeller/react-readonly-codemirror6
- Owner: phartenfeller
- License: mit
- Created: 2021-07-03T06:43:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-31T20:55:18.000Z (almost 2 years ago)
- Last Synced: 2025-02-27T02:57:27.791Z (11 months ago)
- Language: JavaScript
- Homepage: https://phartenfeller.github.io/react-readonly-codemirror6/
- Size: 3.13 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Readonly Codemirror 6 React Hook
I use this component for server-side generated code previews (with Gatsby). It uses [Codemirror 6](https://codemirror.net/6/) which is currently in preview.
## Install
```sh
npm i react-readonly-codemirror6
yarn add react-readonly-codemirror6
```
## Demo
https://phartenfeller.github.io/react-readonly-codemirror6/
## How to use
```jsx
import useRocm from "react-readonly-codemirror6";
const myComponent = () => {
const codeRef = useRocm({
code: 'console.log("Hello World!");',
lang: "js",
fontSize: 14,
});
return (
);
}
```
[List of currently supported languages](https://github.com/phartenfeller/react-readonly-codemirror6/blob/master/react-readonly-codemirror6/src/getLanguageExtension.js). Currently only ones I needed but can be extended.
## Missing
- TS Types
- Support more languages
- More configuration options
## Development
```bash
# in root
yarn
cd react-readonly-codemirror6
yarn link
cd ../demo
yarn
yarn link react-readonly-codemirror6