I'm sure this should be straightforward - but how should I go about getting markdown from a URL and inserting it into a .qmd document, as if I'd copied and pasted it?
For example, if I wanted to grab the example document from https://gist.githubusercontent.com/rt2zz/e0a1d6ab2682d2c47746950b84c0b6ee/raw/83b8b4814c3417111b9b9bef86a552608506603e/markdown-sample.md and drop it into a qmd document, to later output to pdf, how should I go about that?
I've tried the following:
---
title: "Untitled"
format: pdf
editor: visual
---
```{r, results='asis'}
library(httr)
url="https://gist.githubusercontent.com/rt2zz/e0a1d6ab2682d2c47746950b84c0b6ee/raw/83b8b4814c3417111b9b9bef86a552608506603e/markdown-sample.md"
response=GET(url)
print(content(response))
However, when I try to render the document, I get an error "compilation failed- error Undefined control sequence....."
Try replacing print()
with cat()
:
---
title: "Untitled"
format: pdf
editor: visual
---
```{r, results='asis'}
library(httr)
url="https://gist.githubusercontent.com/rt2zz/e0a1d6ab2682d2c47746950b84c0b6ee/raw/83b8b4814c3417111b9b9bef86a552608506603e/markdown-sample.md"
response=GET(url)
cat(content(response))
```