Skip to content

Commit b90c211

Browse files
committed
chore: restore semi-markdown
1 parent 801b1bb commit b90c211

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

js/chat/chat.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ const escapeUnknownTags = (html: string): string =>
147147
: `<${slash + tag + extra}>`
148148
);
149149

150-
function contentToHTML(content: string, content_type: ContentType) {
150+
function contentToHTML(
151+
content: string,
152+
content_type: ContentType | "semi-markdown"
153+
) {
151154
if (content_type == "markdown") {
155+
return unsafeHTML(markdownDOMPurify.sanitize(parse(content) as string));
156+
} else if (content_type == "semi-markdown") {
152157
return unsafeHTML(
153158
markdownDOMPurify.sanitize(escapeUnknownTags(parse(content) as string))
154159
);
@@ -237,7 +242,7 @@ class ChatMessage extends LightElement {
237242

238243
class ChatUserMessage extends LightElement {
239244
@property() content = "...";
240-
@property() content_type: ContentType = "markdown";
245+
@property() content_type: ContentType | "semi-markdown" = "semi-markdown";
241246

242247
render(): ReturnType<LitElement["render"]> {
243248
return contentToHTML(this.content, this.content_type);

0 commit comments

Comments
 (0)