pystitch / stitch

Write reproducible reports in Markdown
https://pystitch.github.io
MIT License
441 stars 13 forks source link

More chunk options compatible with knitr #12

Closed jankatins closed 2 years ago

jankatins commented 8 years ago

It would be nice if these could be compatible with knitr, so that theoretically one could use a rmarkdown document and get it compiled with stitch: http://yihui.name/knitr/options/

EDIT by Tom: Master list

Code Evaluation

TomAugspurger commented 8 years ago

Do you mean the syntax of {kernel [chunk_name], keyword=val}? I went back and forth on that in https://github.com/TomAugspurger/stitch/issues/1 before settling on what's essentially python's syntax of a comma between each argument.

If you mean the actual options and the behavior of them, then yes absolutely.

jankatins commented 8 years ago

I would prefer both (same names and same syntax), just to be able to swap the converter...

TomAugspurger commented 8 years ago

Can you clear up a thing for me? Is the <<mychunk, cache=TRUE>>= style knitr syntax, and {r, mychunk, cache=TRUE} RMarkdown stynax?

In a quick test, all of these are valid RMarkdown

```{r, v1, eval=TRUE}
summary(cars)
summary(cars)
summary(cars)
summary(cars)

But I think we should only support the first and third; you need to have commas  between your arguments.

I think supporting the `<<kernel, [chunk,] keyword=val>>=` would be quite easy as well. Just need to transform that to pandoc style.
jankatins commented 8 years ago

I didn't know that knitr supports both "with comma behind the engine" and "without comma". Nice!

Re knitr vs rmarkdown: as far as I understand it rmarkdown is both a subset of knitr supported formats (e.g. the first one is as far as I know the old sweave syntax; rmarkdown only supports markdown and the '''{...} chunks) and a superset (e.g. the documents syntax in the yaml header and the extensibility gained form that.

E.g. it would be no problem to write latex documents with included code: https://github.com/yihui/knitr/blob/master/inst/examples/knitr-minimal.Rnw

So the problem in knitpy wasn't so much supporting other code chunk types but getting the output right, e.g. switching from md syntax for images to latex syntax (e.g. this line would actually need to be configureable like the output_startmarker in the TemporaryOutputDocument). But that problem is gone by using the filter style language as temp docs, if that format supports everything which needs to be set :-)

TomAugspurger commented 8 years ago

Code Evaluation

Code Decoration

Cache

Plots