简体   繁体   中英

knitted markdown displayed correctly on browser/viewer but not shown properly inside shiny

I have learnt to write markdown in RStudio and able to preview using browser/viewer by compiling the code. But when the same MD is shown inside a shiny app, although most of them shown correctly (including plots), some features like tab, TOC, plot captions etc are not shown inside shiny app. The minimal code is produced here:

---
title: "Title"
output:
html_document:
    toc: TRUE
    toc_float:
      collapsed: FALSE
      smooth_scroll: FALSE
---

# Data Analysis {.tabset .tabset-fade .tabset-pills}

## Sub data Analysis

This section provides ...

I display the above code inside a shiny app server using:

output$markdown <- renderUI({
    HTML(markdown::markdownToHTML('mymd.md'))
    #HTML(rmarkdown::render(knit('mymd.Rmd')))
    #includeHTML("shinybody.html")
    })

and in ui, I am using uiOutput:

 mainPanel(
       uiOutput('markdown'))

Although shiny app display plots and text correctly, features like toc, tabs are not appearing properly. I cross checked by directly compiling md inside viewer/browser it displays correctly. Any hand please..

---
title: '[®γσ, ENG LIAN HU](https://beta.rstudioconnect.com/content/3091/ryo-eng.html)'
subtitle: 'Personal Profile'
author: '[®γσ, Lian Hu](https://englianhu.github.io/) <img src=''www/ENG.jpg''
  width=''24'' align=''center'' valign=''middle''> <img src=''www/my-passport-size-photo.jpg''
  width=''24'' align=''center'' valign=''middle''>®'
date: "10/22/1984"
output:
      html_document: 
        number_sections: yes
        toc: yes
        toc_depth: 4
        toc_float:
          collapsed: yes
          smooth_scroll: yes
        code_folding: hide
---

Changed yaml to below :

---
title: '[®γσ, ENG LIAN HU](https://beta.rstudioconnect.com/content/3091/ryo-eng.html)'
subtitle: 'Personal Profile'
author: '[®γσ, Lian Hu](https://englianhu.github.io/) <img src=''www/ENG.jpg''
  width=''24'' align=''center'' valign=''middle''> <img src=''www/my-passport-size-photo.jpg''
  width=''24'' align=''center'' valign=''middle''>®'
date: "10/22/1984"
    output:
      html_document: 
        number_sections: yes
        toc: yes
        toc_depth: 4
        code_folding: hide
---

测试1 figure 1 shows the collapsable menu as a line

测试2 figure 2 shows the tittle content at top

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM