Simplest way to go from Rmd to jats.xml

I’m looking at the example here: https://github.com/binder-examples/stencila-r/ where there is a Rmd file, and then we click the binder button and get a really nice-looking and interactive document in the browser.

How can I use the stencila cli to convert my Rmd file to a jats.xml that can be executed in the browser like I see in that example repo?

I’m thinking that I could have a code chunk at the end of my Rmd that does this conversion. So that each time I knit the Rmd I also get an updated copy of the jats.xml? Then when I commit and push to GitHub, the document that goes into the binder container is updated also.

The stencila R package seems like a great place to have a function for this, what do you think?

Thanks!

1 Like

Hi @benmarwick :wave:!

Thanks for the questions and suggestions. Sorry for the slow response…I’ve been travelling / catching up after trip to US and Canada. Thanks for hosting the workshop - it was a great opportunity to meet folks interested in reproducible research, get feedback and learn more about the the tools in this space.

We are doing a lot of development on Encoda - our package for converting between alternative formats. Encoda is, along with some of our other tools, integrated into the Stencila CLI. The idea is to have a several, modular packages like Encoda, that can be reused by other developers, but that are aggregated together in CLI and Desktop apps for end-users.

I think your idea is a great one. We could distribute the stencila CLI binary in the stencila R package as the “app” for R end users. It would have functions like stencila::convert('from.Rmd', 'to.jats.xml') that would pass on arguments to the CLI. We could also provide an RStudio plugin that would do that based on the currently open document.

I’ll try to have a look at how much work will be involved next week. My first thought is that it should not be too much work - but there are always gotchas :man_shrugging:. It would be good to at least mark a start on it soon to get people like yourself beta testing it.

2 Likes