r - 如何在 rmarkdown 导航栏中使用子菜单?

标签 r r-markdown navbar

我正在尝试在 rmarkdown 导航栏中创建一个子菜单

这是我的 _site.yml

name: Test dashboard
navbar:
  title: Test dashboard
  left:
  - text: by Commo (intake)
    menu:
    - text: "Menu"
      href: index.html
    - text: "SubMenu"
      menu:
      - text: "Item1"
      - href: index2.html 
      - text: "Item2"
      - href: index3.html 
output:
  html_document:
    include:
      after_body: footer.html
    css: styles.css
    source_code: embed
    lib_dir: site_libs
    mathjax: null
    self_contained: false
output_dir: _site

但是,无论出于何种原因,子菜单的链接都无法正确显示。它们位于部分名称下方,位于具有几个像素高度的非常细的线上。

enter image description here

那有意义吗?

我在用
> packageVersion("rmarkdown")
[1] ‘2.1’

最佳答案

我相信我找到了它无法正常工作的原因。当我在 - 之前删除额外的破折号( href )时s 在子菜单级别,一切似乎都没问题。

整个 _site.yml 看起来像这样:

name: Test dashboard
navbar:
  title: Test dashboard
  left:
  - text: by Commo (intake)
    menu:
    - text: "Menu"
      href: index.html
    - text: "SubMenu"
      menu:
      - text: "Item1"
        href: index2.html 
      - text: "Item2"
        href: https://getbootstrap.com/docs/4.4/components/alerts/
output:
  html_document:
    include:
      after_body: footer.html
    css: styles.css
    source_code: embed
    lib_dir: site_libs
    mathjax: null
    self_contained: false
output_dir: _site

我使用相同的 rmarkdown 版本 (2.1)。

关于r - 如何在 rmarkdown 导航栏中使用子菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61400239/

相关文章:

r - paste0 或 paste 在遇到 r 中的特殊字符时失败

r - 以编程方式在 Markdown 中创建选项卡和绘图

r - 使用 "\n"在 knitr::kable 表格单元格中包装文本

javascript - 导航栏已扩展但有一个子菜单总是折叠

jquery 移动样式不起作用

r - 禁用 cat 命令

r - 通过保留 R 中所有列的行相互添加数据帧

r - 使用 if-else 从下拉列表中进行多项选择 R Shiny

在 R Markdown 中使用 pandoc 和 bookdown 删除图形标题中的冒号

css - Bootstrap 响应式导航栏在较低的 View 比率下出现奇怪的格式