I am producing a report which will be published in pdf format. It concerns statistics and particularly the use of R. Therefore I am using knitr. I would also like to publish it to a wiki, with minimal extra effort by me!

Is it possible to get wiki markup (MediaWiki) output from knitr?

Or, if I generate HTML from knitr, can HTML be given directly to the wiki?

This problem is related to this post. Wiki markup rules are here, but I can't quite see if full HTML is supported.

Thanks.

有帮助吗?

解决方案

You can certainly define the markup rules in knitr output hooks: http://yihui.name/knitr/hooks As one simple example, you can highlight source code with <syntaxhighlight>:

knit_hooks$set(source = function(x, options) {
  sprintf('<syntaxhighlight lang=%s>%s</syntaxhighlight>', options$engine, x)
})

You are free to design the rest of the output hooks. But as Ben Bolker pointed out, I think you are better off with Markdown, and convert that to Mediawiki via Pandoc.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top