UNPKG

@mieweb/wikigdrive

Version:

Google Drive to MarkDown synchronization

18 lines (17 loc) 634 B
import { walkRecursiveSync } from '../markdownNodesUtils.js'; // Related tests // test ./list-test.md // test ./pre-mie.md // test ./block-macro.md export function mergeTexts(markdownChunks) { walkRecursiveSync(markdownChunks.body, (chunk, ctx) => { if (chunk.parent && chunk.isTag === false) { const nextChunk = chunk.parent.children[ctx.nodeIdx + 1]; if (nextChunk?.isTag === false) { chunk.text = chunk.text + nextChunk.text; chunk.parent.children.splice(ctx.nodeIdx + 1, 1); return { nodeIdx: ctx.nodeIdx - 1 }; } } }); }