Skip to content

Commit

Permalink
🐛 Fix markdown escaping for markdown API response format
Browse files Browse the repository at this point in the history
Closes #1857
  • Loading branch information
baptisteArno committed Nov 10, 2024
1 parent cbb38ef commit 0029f67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/viewer/src/test/chat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ test("API chat execution should work on published bot", async ({ request }) => {
).json();
expect(messages[0].content.markdown).toStrictEqual("Hi there! 👋");
expect(messages[1].content.markdown).toStrictEqual(
"Welcome. What's your name?",
"Welcome. What's your name?",
);
});
});
12 changes: 2 additions & 10 deletions packages/rich-text/src/serializer/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,7 @@ export default function serialize(
}
}

if (chunk.parentType === nodeTypes["inline-variable"]) {
if (opts.flavour === "whatsapp") {
return children;
}
return escapeHtml(children);
}
if (chunk.parentType === nodeTypes["inline-variable"]) return children;

switch (type) {
case nodeTypes.heading[1]:
Expand Down Expand Up @@ -250,10 +245,7 @@ export default function serialize(
return `---\n`;

default: {
if (opts.flavour === "whatsapp") {
return children;
}
return escapeHtml(children);
return children;
}
}
}
Expand Down

0 comments on commit 0029f67

Please sign in to comment.