~/code/MASTER_INDEX.md

knitr::opts_chunk$set(echo = TRUE,
                      comment = "      ##",
                      tidy = "styler",
                      error = TRUE,
                      collapse = T   ) # T easier to read
library(jimTools)
library(curl)

get a connection

con  <- curl(url = "http://httpbin.org") 
readLines(con) #HTML



curl(url = "http://httpbin.org/get") 

x  <- curl(url = "http://httpbin.org/get", open = "", handle = new_handle())

##  View
readLines(x)

curl options

library(data.table)
dt  <- data.table()
opts <- curl_options() 

names  <- names(opts)

names(opts)  <- NULL
values  <- opts 

dt  <- data.table(name = names, value = values)  
dt

Use handle to set options, headers, body

h  <- new_handle()
h
str(h)
#| echo = FALSE,
#| message = FALSE,
#| fig.width = 6, 
#| fig.height = 6,
#| fig.path = "figures/",
#| fig.caption = "This is a long caption that fits better inside of a code chunk",
#| fig.alt = "This is a long description that conveys the meaning of the visual."

library(ggplot2)
output_dir  <- Sys.getenv("OUTPUT_DIR")
output_dir

{
# get file
file <- "/home/jim/.config/nvim/templates/skeleton.Rmd"
file  <- normalizePath(file)
file


## Ref only
    # the_dir  <- dirname(file)
    # file  <- basename(file)
    # file  <- file.path(the_dir, file)

}

rmarkdown::render(file,
#                  output_format="html_document",
                    output_format="pdf_document",
                    intermediates_dir='./tmp',
                    clean = F,              # leave tmp files
                    output_dir=output_dir
                  )

html ONLY (fonts)

htmltools::h3("Test big font")
htmltools::h4('Test medium font')
htmltools::h5('Test smaller font')

r htmltools::h3("Outside chunck")



jimrothstein/yt_api documentation built on Nov. 5, 2022, 8:05 p.m.