From 89ca81d1a43f0956a0af0d5fac875cc647ab28c5 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Wed, 5 Nov 2025 17:05:58 +0800 Subject: [PATCH] fix: document deploy (#5867) --- document/next.config.mjs | 10 +--------- document/source.config.ts | 4 +++- packages/global/common/string/textSplitter.ts | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/document/next.config.mjs b/document/next.config.mjs index 737cd3f1e..fbdb49382 100644 --- a/document/next.config.mjs +++ b/document/next.config.mjs @@ -1,14 +1,6 @@ import { createMDX } from 'fumadocs-mdx/next'; -const withMDX = createMDX({ - mdxOptions: { - remarkPlugins: { - image: { - checkImageSize: false - } - } - } -}); +const withMDX = createMDX(); /** @type {import('next').NextConfig} */ const config = { diff --git a/document/source.config.ts b/document/source.config.ts index 153c59297..4e7a48565 100644 --- a/document/source.config.ts +++ b/document/source.config.ts @@ -17,6 +17,8 @@ export const docs = defineDocs({ export default defineConfig({ lastModifiedTime: 'git', mdxOptions: { - // MDX options + remarkImageOptions: { + external: false + } } }); diff --git a/packages/global/common/string/textSplitter.ts b/packages/global/common/string/textSplitter.ts index 803d51468..634f0ef72 100644 --- a/packages/global/common/string/textSplitter.ts +++ b/packages/global/common/string/textSplitter.ts @@ -63,7 +63,7 @@ const strIsMdTable = (str: string) => { return true; }; const markdownTableSplit = (props: SplitProps): SplitResponse => { - let { text = '', chunkSize } = props; + let { text = '', chunkSize, maxSize = defaultMaxChunkSize } = props; // split by rows const splitText2Lines = text.split('\n').filter((line) => line.trim()); @@ -93,7 +93,17 @@ ${mdSplitString} // Over size if (chunkLength + nextLineLength > chunkSize) { - chunks.push(chunk); + // 单行非常的长,直接分割 + if (chunkLength > maxSize) { + const newChunks = commonSplit({ + ...props, + text: chunk + }).chunks; + chunks.push(...newChunks); + } else { + chunks.push(chunk); + } + chunk = defaultChunk; } chunk += `${splitText2Lines[i]}\n`;