From 77f50356aa9adf5c4c6632aa23a9806dfe6e45dc Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Sun, 3 Nov 2024 19:48:27 +0800 Subject: [PATCH] fix: markdownToHtml error --- assets/css/editor/kun-content.scss | 27 +++++++++--------------- components/kun/utils/handleFileChange.ts | 2 +- server/utils/markdownToHtml.ts | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/assets/css/editor/kun-content.scss b/assets/css/editor/kun-content.scss index 846df74a..0d575de6 100644 --- a/assets/css/editor/kun-content.scss +++ b/assets/css/editor/kun-content.scss @@ -132,24 +132,17 @@ table { border: 1px solid var(--kungalgame-blue-5); - border-radius: 5px; - white-space: nowrap; - } - - th, - td { - border: 1px solid var(--kungalgame-blue-5); - padding: 3px; - text-align: left; - } + white-space: pre-wrap; - tr:nth-child(even) { - background-color: var(--kungalgame-trans-blue-1); - } + th, + td { + border: 1px solid var(--kungalgame-blue-5); + padding: 3px; + text-align: left; + } - .tableWrapper { - color: var(--kungalgame-font-color-3); - position: relative; - overflow-x: auto; + tr:nth-child(even) { + background-color: var(--kungalgame-trans-blue-1); + } } } diff --git a/components/kun/utils/handleFileChange.ts b/components/kun/utils/handleFileChange.ts index 384568f2..13f8d2bf 100644 --- a/components/kun/utils/handleFileChange.ts +++ b/components/kun/utils/handleFileChange.ts @@ -40,7 +40,7 @@ export const resizeImage = ( ctx?.drawImage(image, 0, 0, newWidth, newHeight) const resizedFile = dataURItoBlob(canvas.toDataURL('image/webp', 0.77)) - if (resizedFile.size > 1007 * 1024) { + if (resizedFile.size > 1.007 * 1024 * 1024) { useMessage(10112, 'warn') reject(new Error('Image is too large.')) } else { diff --git a/server/utils/markdownToHtml.ts b/server/utils/markdownToHtml.ts index 623a6c07..06af2be6 100644 --- a/server/utils/markdownToHtml.ts +++ b/server/utils/markdownToHtml.ts @@ -14,7 +14,7 @@ export const markdownToHtml = async (markdown: string) => { .use(rehypeSanitize) .use(remarkFrontmatter) .use(remarkGfm) - .use(rehypePrism) + .use(rehypePrism, { ignoreMissing: true }) .use(rehypeStringify) .process(markdown)