File tree Expand file tree Collapse file tree 3 files changed +29
-24
lines changed Expand file tree Collapse file tree 3 files changed +29
-24
lines changed Original file line number Diff line number Diff 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
238243class 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 ) ;
You can’t perform that action at this time.
0 commit comments