markdown fix

This commit is contained in:
LLB
2026-04-10 02:01:20 +04:00
parent 105cbb49f1
commit b0c630a973
+11 -2
View File
@@ -703,6 +703,10 @@ function renderMarkdownPreviewText(markdown: string): string {
inFence = !inFence;
continue;
}
if (line.trim().length === 0) {
if (output.at(-1) !== "") output.push("");
continue;
}
if (inFence) {
output.push(line);
continue;
@@ -1029,12 +1033,17 @@ function renderMarkdownToTelegramHtmlChunks(markdown: string): string[] {
textLines.push(current);
index += 1;
}
renderedBlocks.push(...renderMarkdownTextLines(textLines.join("\n")));
const renderedTextBlock = renderMarkdownTextLines(
textLines.join("\n"),
).join("\n");
if (renderedTextBlock.length > 0) {
renderedBlocks.push(renderedTextBlock);
}
}
const chunks: string[] = [];
let current = "";
for (const block of renderedBlocks) {
const candidate = current.length === 0 ? block : `${current}\n${block}`;
const candidate = current.length === 0 ? block : `${current}\n\n${block}`;
if (candidate.length <= MAX_MESSAGE_LENGTH) {
current = candidate;
continue;