I have a navbar defined in the _site.yml file:
name: "Rmarkdown with navbar"
output_dir: "."
navbar:
title: "Data Analysis"
type: inverse
right:
- text: "Abstract"
href: https://www.stackoverflow.com
- text: "Data Preparing"
href: https://www.stackoverflow.com
- text: "Related Plots"
href: https://www.stackoverflow.com
- text: "Player Selection"
href: https://www.stackoverflow.com
- text: "Conclusion"
href: https://www.stackoverflow.com
output:
html_document:
theme: spacelab
highlight: textmate
I would like to be able to navigate to each section in my main rmd file, each section is defined as:
<section id="name-of-section">
I tried the following but it doesn't work (in the _site.yml file).
right:
- text: "Abstract"
href: #abstract
I would really appreciate any help. It would be even better if I could add navigation animation when clicking (I know it's achievable using jQuery in websites).
Have you try just adding titles and subtitles to your markdown with '#' and "##' and then search for any section in "online document" (Crtl + Shift + "O")
Or you want a navigation panel on the markdown's output document?
If this is the case, have you try something like this at the beginning of your markdown?
---
title: "El Code-Book de Guibi"
output:
html_document:
toc: yes
toc_depth: 5
toc_float: yes
pdf_document:
toc: yes
toc_depth: '5'
editor_options:
markdown:
wrap: 72
---
In my case, it shows output like this:
Related
I am using bookdown to write a book with a web-version, using the bs4_book format. I want my index page (the front page) to not appear in the TOC on the left, i.e. I want the blue circled item in this screenshot not to appear in the TOC:
I tried the directions in the documentation:
# Section name {.unlisted .unnumbered}
but it is to no avail. My pandoc version is > 2.7 as indicated:
> rmarkdown::pandoc_version()
[1] ‘2.11.0.4’
These are the contents of _bookdown.yaml
book_filename: "shiny-book"
language:
ui:
chapter_name: "Chapter "
delete_merged_file: true
new_session: no
rmd_files:
[
"index.Rmd",
"test_chapter.md",
]
_output.yml
bookdown::bs4_book:
repo: https://github.com/smsaladi/phd
includes:
in_header: [ga_script.html, no_robots.html]
index.Rmd
---
title: "Investigations on the computer"
author: "Name"
site: bookdown::bookdown_site
---
`r if (knitr::is_latex_output()) '<!--'`
# Preface {.unlisted .unnumbered}
`r if (knitr::is_latex_output()) '-->'`
In order to make first level sections instead of only chapters html pages of their own, I tried to alter the split_by in the yaml.
I used this code:
---
title: "new book"
author: "My name"
date: "`r Sys.Date()`"
subtitle: "subtitle"
site: bookdown::bookdown_site
output:
bookdown::gitbook:
split_by: chapter
config:
toc:
collapse: subsection
scroll_highlight: yes
before: null
after: null
toolbar:
position: fixed
edit : null
download: null
search: yes
fontsettings:
theme: white
family: sans
size: 2
sharing:
facebook: yes
twitter: yes
google: no
linkedin: no
weibo: no
instapaper: no
vk: no
all: ['facebook', 'google', 'twitter', 'linkedin', 'weibo', 'instapaper']
#bookdown::pdf_book: default
documentclass: book
---
When I change "chapter" into "section", R throws an error.
How can I make sure there will be seperated pages for chapters as well as first level sections?
There were (in this early stage of the document) some chapters without subsections. split_by: section will cause an error in case of chapters without sections.
A basic R markdown script:
---
title: "Untitled"
author: "Example example"
output:
html_document:
df_print: paged
toc: true
number_sections: true
---
# ALPHA Header
## Alpha sub-1
## Alpha sub-2
## Alpha sub-3
Will generate something akin to this:
I'd like to pad the space between the YAML headers and the table of contents - but I'm not sure how. I can specify CSS selector and styles but this only applies to Markdown after the auto generated ToC.
Just add HTML line breaks in your author or title fields:
author: "Example example<br><br>"
Or a div with a certain height:
author: "Example example<div style=\"height: 100px;\"></div>"
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
---
figure 1 shows the collapsable menu as a line
figure 2 shows the tittle content at top
I've used the super versatile Rmarkdown package to create a site for a set of seminars extracted and modified using R.
The _site.yml file looks like this
name: "Seminars at Biostatistics, UCPH"
exclude: ["*.Rmd*", "*.json", "Makefile"]
navbar:
title: "Seminars # Biostatistics, UCPH"
left:
- text: "Upcoming seminars"
icon: fa-lightbulb-o
href: index.html
- text: "Previous seminars"
icon: fa-calendar
href: previous.html
right:
- icon: fa-question fa-lg
href: http://biostat.ku.dk
output:
html_document:
theme: readable
highlight: textmate
include:
after_body: footer.html
toc: true
toc_float: true
css: style.css
When the page is printed on paper then the table-of-content is overlapping the main text which makes it rather useless.
Is it possible to remove the toc when printing? Either directly through arguments in the yaml or possibly through css and #media commands
Of course. In your stylesheet:
#media print {
#TOC { display: none; }
}