type: fix type error.

This commit is contained in:
jaywcjlove
2024-08-05 00:44:13 +08:00
parent 8b4194f5ae
commit d85368cb4f
6 changed files with 10 additions and 5 deletions

View File

@@ -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": {

View File

@@ -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: './' };

View File

@@ -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",

View File

@@ -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';

View File

@@ -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) &&

View File

@@ -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' &&