knitr-opts_knitget

Here are the examples of the r api knitr-opts_knitget taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

12 Examples 7

 is_html_output = function() { 

     knitr::opts_knit$get("rmarkdown.pandoc.to") == "html" 

 } 

 is_html_output = function() { 

     knitr::opts_knit$get("rmarkdown.pandoc.to") == "html" 

 } 

 is_html_output = function() { 

     knitr::opts_knit$get("rmarkdown.pandoc.to") == "html" 

 } 

 is_html_output = function() { 

     knitr::opts_knit$get("rmarkdown.pandoc.to") == "html" 

 } 

 is_html_output = function() { 

     knitr::opts_knit$get("rmarkdown.pandoc.to") == "html" 

 } 

 build_doc_structure  < - function(text) { 

     old.format  < - knitr::opts_knit$get() 

     knitr::opts_knit$set(out.format = "markdown") 

     apat  < - knitr::all_patterns 

     opat  < - knitr::knit_patterns$get() 

     on.exit({ 

         knitr::knit_patterns$restore(opat) 

         knitr:::chunk_counter(reset = TRUE) 

         knitr:::knit_code$restore(list()) 

         knitr::opts_knit$set(old.format) 

     }) 

     knitr::pat_md() 

     content = knitr:::split_file(lines = knitr:::split_lines(text)) 

     code_chunks  < - knitr:::knit_code$get() 

     for (i in seq_along(content)) { 

         if (class(content[[i]]) == "block") { 

             label  < - content[[i]]$params$label 

             content[[i]]$input  < - paste(code_chunks[[label]],  

                 collapse = "\n") 

         } 

     } 

     content[sapply(content, function(part) { 

         all(grepl(pattern = "^\\s*$", x = part$input.src)) &&  

             class(part) == "inline" 

     })]  < - NULL 

     return(content) 

 } 

19 File: _common.R, author: jrnold, license: MIT License

 is_html  < - knitr::opts_knit$get("rmarkdown.pandoc.to") == "html" 

 is_html  < - function() { 

     isTRUE(knitr::opts_knit$get("rmarkdown.pandoc.to") == "html") 

 } 

 rxSuppressMsg  < - function() { 

     if (requireNamespace("knitr", quietly = TRUE)) { 

         if (!is.null(knitr::opts_knit$get("rmarkdown.pandoc.to"))) { 

             return(invisible(NULL)) 

         } 

         else { 

             rxSetSilentErr(as.integer(length(capture.output(message(" "),  

                 type = "message")) == 0L)) 

         } 

     } 

     else { 

         rxSetSilentErr(as.integer(length(capture.output(message(" "),  

             type = "message")) == 0L)) 

     } 

     invisible(NULL) 

 } 

19 File: _common.R, author: pzhaonet, license: MIT License

 doc_type  < - function() knitr::opts_knit$get("rmarkdown.pandoc.to") 

19 File: sp_color_markdown_text.R, author: smithjd, license: MIT License

 sp_color_markdown_text  < - function(x, color) { 

     outputFormat = knitr::opts_knit$get("rmarkdown.pandoc.to") 

     if (outputFormat == "latex")  

         paste0("\\textcolor{", color, "}{", x, "}") 

     else if (outputFormat == "html")  

         paste0(" < font color='", color, "'>", x, " < /font>") 

     else x 

 } 

19 File: _common.R, author: XiangyunHuang, license: MIT License

 doc_type  < - function() knitr::opts_knit$get("rmarkdown.pandoc.to") 

Categories r Tags