问题
Knitr produces a nice, syntax highlighted code when using a code chunk as below.
```sql
SELECT column
FROM table
```
Is it possible to achieve the same thing but with the sql code stored in a file? Something like:
```sql
read_chunk('mycode.sql')
```
回答1:
I think you can use an inline R expression to achieve it:
```sql
`r xfun::file_string('mycode.sql')`
```
来源:https://stackoverflow.com/questions/24524594/pretty-print-sql-code-from-separate-file-with-knitr