emacs/layers.personal/misctools/my-polymode/local/polymode/samples/merge.notmd
2018-04-07 10:54:04 +08:00

27 lines
549 B
Plaintext

-*- mode: poly-markdown+r -*-
^^^^^^^^^^^^^^^------- local variable activates apropriate polymode
This demo shows you how to merge the source and output blocks in markdown
output. Note **knitr** puts R source and output in separate blocks by default.
```r
# first ``` are the end of previous source block; second ``` are the
of next output block
knit_hooks$set(chunk = function(x, options) {
gsub("```\n+```", "", x)
})
```
See if it works:
```r
a = 1
a
## [1] 1
```
Source and output lived together happily ever in **knitr**.