diff --git a/package.json b/package.json index 5b1ca8a..3ec9a01 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "husky": "^8.0.1", "lerna": "^8.0.0", "prettier": "^3.0.2", + "react": "~18.2.0", + "react-dom": "~18.2.0", "tsbb": "~4.4.0" }, "workspaces": { diff --git a/website/.kktrc.ts b/website/.kktrc.ts index 2a1c057..6d58246 100644 --- a/website/.kktrc.ts +++ b/website/.kktrc.ts @@ -20,6 +20,8 @@ export default (conf: Configuration, env: 'development' | 'production', options: }), ); + /** https://github.com/kktjs/kkt/issues/446 */ + conf.ignoreWarnings = [{ module: /node_modules[\\/]parse5[\\/]/ }]; conf.module!.exprContextCritical = false; if (env === 'production') { conf.output = { ...conf.output, publicPath: './' }; diff --git a/website/package.json b/website/package.json index 913f670..a6de43f 100644 --- a/website/package.json +++ b/website/package.json @@ -28,8 +28,8 @@ "@uiw/react-markdown-editor": "^6.0.0", "@wcj/dark-mode": "^1.0.15", "css-tree": "^2.2.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", + "react": "~18.2.0", + "react-dom": "~18.2.0", "react-hot-toast": "^2.3.0", "react-router-dom": "^6.3.0", "rehype-attr": "^3.0.0", diff --git a/website/src/pages/home/index.tsx b/website/src/pages/home/index.tsx index 386b307..241ed72 100644 --- a/website/src/pages/home/index.tsx +++ b/website/src/pages/home/index.tsx @@ -1,5 +1,6 @@ import MarkdownEditor, { getCommands } from '@uiw/react-markdown-editor'; import { useContext } from 'react'; +// @ts-ignore import { EditorView } from '@codemirror/view'; import { Preview } from './Preview'; import { copy } from '../../commands/copy'; diff --git a/website/src/utils/css.ts b/website/src/utils/css.ts index 53c7ae8..7a9effa 100644 --- a/website/src/utils/css.ts +++ b/website/src/utils/css.ts @@ -129,7 +129,7 @@ export const footnotesLabel = (node: Element) => { ]; }; -export const imagesStyle = (node: Element, parent: Root | Element | null) => { +export const imagesStyle = (node: Element, parent: Root | Element | undefined) => { if ( parent?.type === 'element' && /(p|a)/.test(parent.tagName) && diff --git a/website/src/utils/markdownToHTML.ts b/website/src/utils/markdownToHTML.ts index dbefedb..54c7b79 100644 --- a/website/src/utils/markdownToHTML.ts +++ b/website/src/utils/markdownToHTML.ts @@ -26,21 +26,21 @@ export function markdownToHTML(md: string, css: string, opts: MarkdownToHTMLOpti parseCustomProperty: false, positions: false, }); + // @ts-ignore const data = cssdata(ast.children.head, {}, { color: opts.preColor, theme: opts.previewTheme }); const processor = unified() .use(remarkParse) .use(remarkGfm) .use(remarkRehype, { allowDangerousHtml: true }) + .use(rehypeRaw) .use(rehypePrism, { ignoreMissing: true, }) - .use(rehypeRaw) .use(rehypeIgnore, {}) .use(rehypeAttrs, { properties: 'attr' }) .use(rehypeRewrite, { rewrite: (node, _index, parent) => { - // @ts-ignore if ( node?.type === 'element' && node?.tagName === 'code' &&