Last active
March 21, 2018 14:25
-
-
Save adomingues/96f6cc427cf991360a97 to your computer and use it in GitHub Desktop.
A simple wrapper to knit an Rmd file to output an html from the comand-line using Pandoc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
infile=$1 | |
if [[ $infile == *.Rmd ]] | |
then | |
echo "Knitting Rmd file" | |
Rscript -e "library(knitr); knit('$infile')"; | |
name=${infile%.Rmd} | |
else | |
echo "Markdown file" | |
name=${infile%.md} | |
fi | |
# pandoc --from=markdown --to=html --output=$name".html" -s --highlight-style tango $name".md" | |
OUTFILE=$name | |
Rscript -e "rmarkdown::render('${OUTFILE}.md', 'html_document', output_file = '${OUTFILE}.html')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment