在shinydashboard::box中设置帮助文本格式 [英] format helpText in shinydashboard::box

查看:0
本文介绍了在shinydashboard::box中设置帮助文本格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我闪亮的应用程序的仪表板框中有一个帮助文本小部件。 在shinydashboard::box()之外的帮助文本可以很容易地格式化,但是,在box()中,换行符以及其他HTML元素是不受欢迎的。 请在下面找到我的代码和我当前获得的图像。

validation_rules_text_cas<-helpText('Please enter one string per line.', # ----
                        "A CAS Registry Number includes up to 10 digits which are separated in 3 hyphens.",
                        '- The first part of the number, starting from the left, has 2 to 7 digits',
                        '- The second part has 2 digits',
                        '- The final part consists of a single check digit.')
validation_rules_text_inchikey<-helpText('Please enter one string per line.',
                                  "International Chemical Identifier KEY validation rules.  InChIKey consists of several distinct components:",
                                  "- 14 characters resulting from a hash of the connectivity information of the InChI,encodes molecular skeleton (connectivity),",
                                  "- followed by a hyphen,",
                                  "- followed by 8 characters resulting from a hash of the remaining layers of the InChI,",
                                  "- Encodes proton positions (tautomers), stereochemistry, isotopomers, reconnected layer,",
                                  "- followed by a single character indicating the kind of InChIKey,",
                                  "- followed by a single character indicating the version of InChI used,",
                                  "- another hyphen,",
                                  "- followed by single character indicating protonation.(Source: Wikipedia).",
                                  "  AAAAAAAAAAAAAA-BBBBBBBBCD-E")

tabPanel("Batch Search", #----
                        fluidRow(column(5),
                                 column(7,# helpText----
                                        box(title=' CAS Validation Rules',width=12,
                                            collapsible = TRUE,
                                            collapsed=TRUE,
                                            status = 'primary',
                                            validation_rules_text_cas
                                          ),
                                        box(title='Inchikey Validation Rules',width=12,
                                            collapsible = TRUE,
                                            collapsed=TRUE,
                                            status = 'primary',
                                            validation_rules_text_inchikey
                                        ),
                                        box(title='SMILES Validation Rules',width=12,
                                            collapsible = TRUE,
                                            collapsed=TRUE,
                                            status = 'primary',
                                            validation_rules_text_smiles
                                        ),
                                        box(title='Validation Rules - OTHER',width=12,
                                            collapsible = TRUE,
                                            collapsed=TRUE,
                                            status = 'primary',
                                            validation_rules_text_other
                                        ))
))
  

如何添加换行符(标记$br())或换行符(标记$hr())?谢谢您

推荐答案

使用renderText中的 可以做到这一点。试试这个

ui <- fluidPage(
  tags$head(tags$style("#inchikey{color: blue;
                                   font-size: 16px;
                                   line-height: 0.6;
                                  }"
  )),

tabPanel("Batch Search", #----
         fluidRow(column(5),
                  column(7,# helpText----
                         box(title=' CAS Validation Rules',width=12,
                             collapsible = TRUE,
                             collapsed=TRUE,
                             status = 'primary',
                             validation_rules_text_cas
                         ),
                         box(title='Validation Rules - OTHER',width=12,
                             collapsible = TRUE,
                             collapsed=TRUE,
                             status = 'primary',
                             verbatimTextOutput("inchikey")
                             #validation_rules_text_inchikey
                         )
                         )
         ))
)

server <- function(input, output, session) {
  output$inchikey <- renderText({
    paste("Please enter one string per line.,   

  International Chemical Identifier KEY validation rules.  InChIKey consists of several distinct components: 

  - 14 characters resulting from a hash of the connectivity information of the InChI,encodes molecular skeleton (connectivity), 

  - followed by a hyphen, 

  - followed by 8 characters resulting from a hash of the remaining layers of the InChI, 

  - Encodes proton positions (tautomers), stereochemistry, isotopomers, reconnected layer, 

  - followed by a single character indicating the kind of InChIKey, 

  - followed by a single character indicating the version of InChI used, 

  - another hyphen,  

  - followed by single character indicating protonation.(Source: Wikipedia). 

    AAAAAAAAAAAAAA-BBBBBBBBCD-E", sep="
")
    
  })
}

shinyApp(ui = ui, server = server)

这篇关于在shinydashboard::box中设置帮助文本格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆