Skip to content

Instantly share code, notes, and snippets.

@noamross
Created March 1, 2018 14:57
Show Gist options
  • Save noamross/17699c7b61ca52035d58a45eee54b5a2 to your computer and use it in GitHub Desktop.
Save noamross/17699c7b61ca52035d58a45eee54b5a2 to your computer and use it in GitHub Desktop.
library(googledrive)
gdoc_to_md <- function(file, path=NULL, markdown="markdown") {
td <- tempdir()
gf <- googledrive::drive_download(
file, path = td,
type = "application/epub+zip", overwrite = TRUE
)
if (is.null(path)) {
path <- file.path(getwd(), paste0(gf$name, ".md"))
}
rmarkdown::pandoc_convert(
input = gf$local_path,
to = markdown,i
from = "epub", output = path
)
# Add function or pandoc filter ot to clean URLs
}
gdoc_to_md(as_id("https://docs.google.com/document/d/1mr7WLlJmsnN2C_iKT1vBVgMlYgFJZDK6dLthbJu3ofM/edit#"))4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment