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

时间:2020-04-24 02:44:06

标签: 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’

1 个答案:

答案 0 :(得分:9)

我相信我发现了为什么它无法正常工作。当我在子菜单级别的-之前删除多余的破折号(href)时,一切似乎都没问题。

整个_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)。

相关问题