Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active May 24, 2017 19:18
Show Gist options
  • Save mikelove/5618f935ace6e389d3fbac03224860cd to your computer and use it in GitHub Desktop.
Save mikelove/5618f935ace6e389d3fbac03224860cd to your computer and use it in GitHub Desktop.
convert Rnw to Rmd
perl -pe 's|\\Robject{(.+?)}|`\1`|g' |
perl -pe 's|\\Rcode{(.+?)}|`\1`|g' |
perl -pe 's|\\Rclass{(.+?)}|*\1*|g' |
perl -pe 's|\\Rfunction{(.+?)}|*\1*|g' |
perl -pe 's|\\texttt{(.+?)}|`\1`|g' |
perl -pe 's|\\textit{(.+?)}|*\1*|g' |
perl -pe 's|\\textbf{(.+?)}|**\1**|g' |
perl -pe 's|\\emph{(.+?)}|*\1*|g' |
perl -pe 's|<<|```{r |g' |
perl -pe 's|>>=|}|g' |
perl -pe 's|@|```|g' |
perl -pe 's|\\section{(.+?)}|# \1|g' |
perl -pe 's|\\subsection{(.+?)}|## \1|g' |
perl -pe 's|\\subsubsection{(.+?)}|### \1|g' |
perl -pe 's|\\Biocexptpkg{(.+?)}|`r Biocexptpkg("\1")`|g' |
perl -pe 's|\\Biocpkg{(.+?)}|`r Biocpkg("\1")`|g' |
perl -pe 's|\\cite{(.+?)}|[@\1]|g' |
perl -pe 's|\\url{(.+?)}|<\1>|g' |
perl -pe 's|\\label{.+?}||g' |
perl -pe 's|\\deseqtwo{}|DESeq2|g' |
@lgatto
Copy link

lgatto commented May 24, 2017

Thank you, very handy. I wrapped it up in a short script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment