markdown, knitr, pandoc, are fantastic tools, and rmarkdown does a great job at linking all the steps. However, it seems to me that the Rmd format has also the potential to complement the oft-limiting markdown specs, with custom extensions tailored for data-heavy and/or finely-formatted reports.
There are two aspects to this proposal:
- Convenience. Sure, we can already specify a custom figure alignment, figure size, etc. by embedding a figure in a knitr chunk,
{r echo=FALSE, out.width="0.8\\textwidth", fig.align='center'}
knitr::include_graphics('external_pic.png')
or start a paragraph with
`r newthought('In his later books')` Tufte...
but it's hardly convenient, and affects legibility. Since R (knitr) is going to process the Rmd file before pandoc ever sees it, we could introduce an arbitrary convention to make it more writer-friendly, e.g.
.{width='0.8', align='center'}
![](external_pic.png)
and
.{$ In his later books} Tufte...
which knitr would process to output valid markdown to feed to pandoc, with raw html or tex where necessary, conditional on the chosen output format.
The delimiters would
- More flexibility. markdown is, by design, limited in features (tables, bibliography, styles, etc.). With a pre-processing step and a language such as R, we are free to overcome such limitations and add new features. This is particularly important in data-heavy reports, but also complex / polished documents such as books, where the simplicity of the markdown language can be limiting. (this is particularly visible with the number of existing / requested extensions in any markdown implementation).
If there's a strong reason to keep the Rmd format 100% markdown-compatible (e.g displaying the source nicely on github), then such extensions could simply be wrapped in backticks like the current inline r syntax.