From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: convert rmarkdown (rmd) files to orgmode? Date: Wed, 20 Jul 2016 10:20:09 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPvAO-0005d3-A2 for emacs-orgmode@gnu.org; Wed, 20 Jul 2016 13:20:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPvAK-0001nG-GI for emacs-orgmode@gnu.org; Wed, 20 Jul 2016 13:20:16 -0400 Received: from iport-bcv3-out.ucsd.edu ([132.239.0.89]:4941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPvAK-0001mV-7j for emacs-orgmode@gnu.org; Wed, 20 Jul 2016 13:20:12 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Xebar Saram Cc: org mode , Philip Hudson On Wed, 20 Jul 2016, Xebar Saram wrote: > thx phil > > the Rmd format is actually quite different than md so that conversion didnt > go well > I tried this pandoc -f markdown -t org input-file.Rmd -o output-file.org then I opened `output-file.org' and put this src block at the very top: #+BEGIN_SRC emacs-lisp :results silent (replace-regexp "^=[{]r \\([^}]*\\)[}]\\(.*\\)=$" "#+name: \\1 ,#+begin_src R \\2 ,#+end_src") #+END_SRC When I execute that code block, all the converted code chunks become src blocks. This isn't perfect as chunk options are appended to the `#+NAME:...' line, but if you want to play with the regexp's you can probably get it to pick those out and put them on a separate line. Or just write another src block with another `replace-regexp' to fix those lines. With a little effort you can write a command file for `sed' to do what the code block above does and then pipe the pandoc output to that command like this: : pandoc -f markdown -t org input-file.Rmd | \ : sed -f convert-chunks > output-file.org and you have an org document ready (or almost ready) to go. HTH, Chuck