twinny 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10012,7 +10012,7 @@ export class ConversationManager {
10012
10012
  pendingText += text;
10013
10013
  };
10014
10014
  const addPendingTextLine = (line) => {
10015
- pendingText += `${pendingText.length === 0 || pendingText.endsWith("\n") ? "" : "\n"}${line}`;
10015
+ pendingText = appendMarkdownLine(pendingText, line);
10016
10016
  };
10017
10017
  const startPendingTextLine = () => {
10018
10018
  if (pendingText.length > 0 && !pendingText.endsWith("\n")) {
@@ -10194,7 +10194,7 @@ class LarkPostContentBuilder {
10194
10194
  this.options = options;
10195
10195
  }
10196
10196
  addTextLine(line) {
10197
- this.pendingText += `${this.pendingText.length === 0 || this.pendingText.endsWith("\n") ? "" : "\n"}${line}`;
10197
+ this.pendingText = appendMarkdownLine(this.pendingText, line);
10198
10198
  }
10199
10199
  startTextLine() {
10200
10200
  if (this.pendingText.length > 0 && !this.pendingText.endsWith("\n")) {
@@ -10293,6 +10293,16 @@ function renderCodexAtTagsAsPlainText(text) {
10293
10293
  .map((part) => part.kind === "at" ? `@${part.openId}` : part.text)
10294
10294
  .join("");
10295
10295
  }
10296
+ function appendMarkdownLine(text, line) {
10297
+ if (line.length === 0) {
10298
+ return text.length === 0
10299
+ ? "\n"
10300
+ : text.endsWith("\n")
10301
+ ? `${text}\n`
10302
+ : `${text}\n\n`;
10303
+ }
10304
+ return `${text}${text.length === 0 || text.endsWith("\n") ? "" : "\n"}${line}`;
10305
+ }
10296
10306
  function splitCodexAtText(text) {
10297
10307
  const parts = [];
10298
10308
  const codeRanges = markdownCodeRanges(text);