Customizing Details

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(details)

You can customize the details output:

  1. Customizing the title
  2. Controlling if it is opened or closed
  3. Customizing the Tooltip
  4. Setting the highlight language
  5. Toggling off the language

Default

  R.version %>%
  details::details()

Title

R.version.string %>%
  details::details(
    summary = 'R Version'
  )

Manipulating the title style

R.version.string %>%
  details::details(
    summary = '<font color="red"> R Version </font>'
  )

Open

R.version.string %>%
  details::details(
    summary = 'Open by default',
    open = TRUE
  )

Tooltip

R.version.string %>%
  details::details(
    summary = 'Use the current date as the tooltip',
    tooltip = Sys.Date()
  )

Language

readLines(
  'https://raw.githubusercontent.com/metrumresearchgroup/covrpage/master/_pkgdown.yml'
  )%>%
  details::details(
    summary = 'yaml example',
    lang = 'yml'
    )

Raw

details::details(
'<h1 style="color:blue;">This is a Blue Heading</h1><br>
<p style="border: 1px solid powderblue;">There is a border around the text</p>',
summary = 'Raw code example',
lang = 'none'
)


Try the details package in your browser

Any scripts or data that you put into this service are public.

details documentation built on March 28, 2022, 1:06 a.m.