File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,13 @@ chat_ui <- function(
112112      tag_name  <-  " shiny-chat-message" 
113113    }
114114
115-     ui  <-  with_current_theme({
116-       htmltools :: renderTags(content )
117-     })
115+     #  `content` is most likely a string, so avoid overhead in that case
116+     #  (it's also important that we *don't escape HTML* here).
117+     if  (is.character(content )) {
118+       ui  <-  list (html  =  paste(content , collapse  =  " \n " 
119+     } else  {
120+       ui  <-  with_current_theme(htmltools :: renderTags(content ))
121+     }
118122
119123    tag(
120124      tag_name ,
Original file line number Diff line number Diff line change @@ -48,10 +48,14 @@ output_markdown_stream <- function(
4848  width  =  " 100%" 
4949  height  =  " auto" 
5050) {
51- 
52-   ui  <-  with_current_theme({
53-     htmltools :: renderTags(content )
54-   })
51+   
52+   #  `content` is most likely a string, so avoid overhead in that case
53+   #  (it's also important that we *don't escape HTML* here).
54+   if  (is.character(content )) {
55+     ui  <-  list (html  =  paste(content , collapse = " \n " 
56+   } else  {
57+     ui  <-  with_current_theme(htmltools :: renderTags(content ))
58+   }
5559
5660  htmltools :: tag(
5761    " shiny-markdown-stream" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments