Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooling to deal with episodes written using Rmarkdown #30

Closed

Conversation

fmichonneau
Copy link
Contributor

This is my proposal to deal with Rmarkdown files with the new template.

Currently, episodes will live in the _episodes_rmd folder. These files are just like the markdown files that are normally written for lessons that don't use Rmarkdown, except they can include chunks of R code. I included an example Rmd file in this PR (_episodes_rmd/06-rmarkdown-example.Rmd)

On the technical side:

  • I modified the hook functions to make sure that the output from knitr get stylized correctly with the new template
  • the figures are generated in the correct place, and the path gets modified to match where they will live once the website is generated
  • all figures generated by a Rmarkdown file get prefixed with swc-rmd- so they can be identified easily by the Makefile and removed by make clean
  • I added a target lesson-rmd that calls a bash script. This script checks whether there is a _episodes_rmd folder and if it exists, the Rmd files get converted into md files inside the _episodes folder. This approach should mean that the Makefile will run smoothly if there is no episodes_rmd.

It seems the Makefile can be improved, as the Rmd files get converted to md each time make serve or make site is invoked, even if the Rmd files don't change.

If the approach seems reasonable, I can try to start converting a few episodes for one of our R lessons to make sure everything runs smoothly.

@gvwilson
Copy link
Contributor

This looks excellent - can regular _episodes/* files and _episodes_rmd/* coexist, i.e., can we have a lesson that has files of both kinds (assuming their names are numbered to avoid collisions)?

@fmichonneau
Copy link
Contributor Author

yes, they can coexist, and they do in this PR.

@fmichonneau
Copy link
Contributor Author

Replaced by:
carpentries/styles#56 (add tools to style repo instead)
#31 (add just an example lesson in this repo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants