CodeBlock
- The
CodeBlock
extension allows you to add code blocks to your editor. It uses prism-code-editor-lightweight for syntax highlighting.
Usage
tsx
import { CodeBlock } from 'reactjs-tiptap-editor/codeblock';
import 'prism-code-editor-lightweight/layout.css';
import 'prism-code-editor-lightweight/themes/github-dark.css';
const extensions = [
...,
// Import Extensions Here
CodeBlock,
];
- You can write
```
, press Enter, and write some code! It loads the language on the fly.