diff --git a/core/README.md b/core/README.md index 5c012acc..53b20dbe 100644 --- a/core/README.md +++ b/core/README.md @@ -39,10 +39,11 @@ https://uiwjs.github.io/react-textarea-code-editor/ [![Open in Github gh-pages](https://img.shields.io/badge/Open%20In-Github%20gh--pages-blue?logo=github)](https://uiwjs.github.io/react-textarea-code-editor/) ```jsx +import React, { useState } from "react"; import CodeEditor from '@uiw/react-textarea-code-editor'; -function App() { - const [code, setCode] = React.useState( +export default function App() { + const [code, setCode] = useState( `function add(a, b) {\n return a + b;\n}` ); return ( @@ -53,7 +54,6 @@ function App() { onChange={(evn) => setCode(evn.target.value)} padding={15} style={{ - fontSize: 12, backgroundColor: "#f5f5f5", fontFamily: 'ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace', }} diff --git a/core/src/utils.ts b/core/src/utils.ts index 63bd7fce..e6286017 100644 --- a/core/src/utils.ts +++ b/core/src/utils.ts @@ -1,8 +1,11 @@ -import { PluggableList } from 'unified'; +import { PluggableList, Pluggable } from 'unified'; import { rehype } from 'rehype'; import rehypePrism from 'rehype-prism-plus'; -export const processHtml = (html: string, plugins: PluggableList = [[rehypePrism, { ignoreMissing: true }]]) => { +export const processHtml = ( + html: string, + plugins: PluggableList = [[rehypePrism, { ignoreMissing: true }]] as Pluggable[], +) => { return rehype() .data('settings', { fragment: true }) .use([...plugins])