Knit R Markdown using the classic Docco style

Description

The classic Docco style is a two-column layout, with text in the left and code in the right column.

Usage

1
rocco(input, ...)

Arguments

input

path of the input R Markdown file

...

arguments to be passed to knit2html

Details

The output HTML page supports resizing and hiding/showing the two columns. Move the cursor to the center of the page, and it will change to a bidirectional resize cursor; drag the cursor to resize the two columns. Press the key t to hide the code column (show the text column only), and press again to hide the text column (show code).

Value

An HTML file is written, and its name is returned.

Author(s)

Weicheng Zhu and Yihui Xie

References

The Docco package by Jeremy Ashkenas: https://github.com/jashkenas/docco

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
rocco_view = function(input) {
    if (!file.exists(input)) 
        return()
    o = rocco(input, header = "", quiet = TRUE)
    if (interactive()) 
        browseURL(o)
}
# knit these two vignettes using the docco style
rocco_view(system.file("doc", "docco-classic.Rmd", package = "knitr"))
rocco_view(system.file("doc", "knit_expand.Rmd", package = "knitr"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.