R code within blogspot

Hi. I am attempting to share some R code within a blogspot blog , but the blog wants to insert an image rather than just list the code. I assume the blogspot is essentially an HTML file. There is no difficulty with listing the remainder of the code. I think I need an escape code somewhere, but I don't want it to appear in the blog output. The offending R code statement is:

which even this thread will not reproduce correctly.

labels <- c("")

I would look to the htmltools package for useful functions.
For example :

library(shiny)
library(htmltools)

common_text <- 
  r'(
labels <- c(
"<img src='https://forum.posit.co/user_avatar/community.rstudio.com/fcas80/90/24140_2.png' width='35' />"
)
  )'

ui <- fluidPage(
  div(
    h6("htmltools::HTML"),
    htmltools::HTML(common_text),
    h6("htmltools::code"),
    htmltools::code(common_text), 
    )
  
)
server <- function(input, output, session) {}

shinyApp(ui, server)

extending my example to be more explicit; in HMTL there is a specific tag whos function is to show code as code. this is that HTML tools code write out for you

> htmltools::code("some content")
<code>some content</code>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.