Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions R/html-dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,12 @@ ace_html_dependency <- function() {
script = "ace.js"
)
}

headroom_html_dependency <- function() {
htmltools::htmlDependency(
name = "headroom",
version = "0.11.0",
src = system.file("lib/headroom", package = "learnr"),
script = "headroom.js"
)
}
5 changes: 5 additions & 0 deletions R/tutorial-format.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#' @param smart Produce typographically correct output, converting straight quotes to curly quotes,
#' \code{---} to em-dashes, \code{--} to en-dashes, and \code{...} to ellipses.
#' Deprecated in \pkg{rmarkdown} v2.2.0.
#' @param with_headroom Should the menu be dynamically hidden when the user scroll? Defaults to \code{FALSE}.
#' @param ... Forward parameters to html_document
#'
#' @export
Expand All @@ -45,6 +46,7 @@ tutorial <- function(fig_width = 6.5,
includes = NULL,
md_extensions = NULL,
pandoc_args = NULL,
with_headroom = FALSE,
...) {

# base pandoc options
Expand Down Expand Up @@ -103,6 +105,9 @@ tutorial <- function(fig_width = 6.5,
tutorial_html_dependency(),
tutorial_autocompletion_html_dependency(),
tutorial_diagnostics_html_dependency(),
{
if (with_headroom) headroom_html_dependency()
},
htmltools::htmlDependency(
name = "tutorial-format",
version = utils::packageVersion("learnr"),
Expand Down
Loading