| 1 | "use client"; |
| 2 | |
| 3 | import { |
| 4 | CodeBlockPlugin, |
| 5 | CodeLinePlugin, |
| 6 | CodeSyntaxPlugin, |
| 7 | } from "@platejs/code-block/react"; |
| 8 | import { all, createLowlight } from "lowlight"; |
| 9 | |
| 10 | import { |
| 11 | CodeBlockElement, |
| 12 | CodeLineElement, |
| 13 | CodeSyntaxLeaf, |
| 14 | } from "@/components/plate/ui/code-block-node"; |
| 15 | |
| 16 | const lowlight = createLowlight(all); |
| 17 | |
| 18 | export const CodeBlockKit = [ |
| 19 | CodeBlockPlugin.configure({ |
| 20 | node: { component: CodeBlockElement }, |
| 21 | options: { lowlight }, |
| 22 | shortcuts: { toggle: { keys: "mod+alt+8" } }, |
| 23 | }), |
| 24 | CodeLinePlugin.withComponent(CodeLineElement), |
| 25 | CodeSyntaxPlugin.withComponent(CodeSyntaxLeaf), |
| 26 | ]; |
| 27 |