Is there any modification of an existing tool or new tool that will syntax-highlight (colour) blocks of R code in a knitr markdown document when opened in Emacs?
The knitr chunks I am looking at are triple-backtick blocks [```]
that contain R code inside.
EDIT: things that I tried so far:
- Ubuntu 12.04 with Emacs 23
emacs --version GNU Emacs 23.3.1
1. Polymode
https://github.com/vitoshka/polymode/issues/3
I am trying to get polymode to syntax-highlight my Rmd files, but it's complaining about a 'color' load file:
cd ~/.emacs.d git clone https://github.com/vitoshka/polymode.git
In my .emacs file:
(add-to-list 'load-path "/home/avilella/.emacs.d/polymode/") (add-to-list 'load-path "/home/avilella/.emacs.d/polymode/modes/") ;; Require any polymode bundles that you are interested in: (require 'poly-R) (require 'poly-markdown)
eval-buffer:
Cannot open load file: color
- CentOS with Emacs 24:
emacs --version GNU Emacs 24.2.1
1. Polymode installed correctly
Open a Rmd file, M-x polymode-minor-mode
, no change to the syntax highlighting.
emacs --version GNU Emacs 24.3.1
1. Polymode installed correctly
Open a Rmd file, M-x poly-markdown+r-mode
, some of the syntax highlighting starts to appear, but I need to manually modify the test in each triple-tick block of code for it to fully show the syntax.
The second image is just after typing a Return before the knitr block.
This might help: http://sjp.co.nz/posts/emacs-ess-knitr/
Knitr markdown in Emacs through ESS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With