From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Fwd: Anyone using or interested in an org to Rmarkdown exporter? Date: Sat, 1 Nov 2014 17:37:02 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1803618260-1414888622=:4424" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkjAm-00038w-PO for emacs-orgmode@gnu.org; Sat, 01 Nov 2014 20:37:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkjAh-0002E7-K5 for emacs-orgmode@gnu.org; Sat, 01 Nov 2014 20:37:36 -0400 Received: from iport-bcv1-out.ucsd.edu ([132.239.0.119]:62274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkjAh-0002DS-5E for emacs-orgmode@gnu.org; Sat, 01 Nov 2014 20:37:31 -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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Hendy Cc: emacs-orgmode This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1803618260-1414888622=:4424 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Sat, 1 Nov 2014, John Hendy wrote: [snip] > From: John Hendy > Date: Fri, Oct 31, 2014 at 7:32 PM > Subject: Re: [O] Anyone using or interested in an org to Rmarkdown exporter? > To: Grant Rettke > > > On Thu, Oct 30, 2014 at 11:37 AM, Grant Rettke wrote: >> Good morning, >> >> Last week I started learning about [RMarkdown]. It is a [literate >> programming] tool implemented in, and for, the [ℝ programming >> language]. Although I haven't dug in deep yet, I do know that (1) it is >> /basically/ [Markdown] and that (2) `org' exports both to [vanilla >> markdown] and also [GitHub flavored Markdown] and that (3) a lot of my >> peers use `RMarkdown' and not `org'. With that that in mind I got >> curious about what it would take to write an `org2rmarkdown' exporter. >> >> The scope of my interest is one-time exports for the most basic and >> simple `org' document. As such, right now I have no requirements beyond >> thinking about the opportunity. After doing some Internet searches, >> there does not seem to be an exporter right now. Questions: >> >> • Does one exist and I missed it? > > Possibly; at least in some form it does: > - https://github.com/chasberry/orgmode-accessories/blob/master/ox-ravel.org > >> • Do you have any interest in such an exporter? > > Yes! > - https://lists.gnu.org/archive/html/emacs-orgmode/2014-01/msg01436.html > - https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00291.html > >> • Has anyone else ever thought of doing this? If yes, why didn't you? > > Yes: > - Don't know elisp > - Found the above, which mostly worked. I had to edit my Org file to > feature a carriage return between text and my lists. ox-ravel appears > to export literally, Actually ox-ravel uses derived backends (see the docstring for `org-export-define-derived-backend'. Exporting lists and other orgmode markup to Rmarkdown is handled by the `md' exporter in ox-md.el. > and it appears knittr won't pick up a list if > there's no blank line between regular text and a list. No, it doesn't. knitr assumes the markdown (or LaTeX or whatever it is processing) is correct as written. > In other words, > this: > > list > - item1 > - item2 > > Isn't the same as this: > > list > > - item1 > - item2 If this is a bug (as it seems), it should probably get a thread with a subject line like `org-md-plain-list needs newline' and your example above as the ECM. It is really easy to force `org-md-plain-list' to do this like so: #+BEGIN_SRC emacs-lisp (defun org-md-plain-list (plain-list contents info) "Transcode PLAIN-LIST element into Markdown format. CONTENTS is the plain-list contents. INFO is a plist used as a communication channel." (concat "\n" contents)) #+END_SRC but this adds vertical padded around nested lists, so something a bit more sophisticated is needed. > > Probably a simple enough fix, but just pointing out one nuance that > org in general and other exporters don't struggle with (they recognize > a list even with no blank line). The `md' exporter knows the list is a list - it just doesn't add the newline that tells pandoc (or whatever) that the next line could start a list. > >> • My guess is that doing an exporter that [builds on an existing >> exporter], mentioned above, would be a great start. Thoughts? >> • The big difference seems to be control statements passed to the >> interpreter, which may or may not be necessary to convert. If not, >> than the *stock* `markdown' exporter would provide everything >> > > See if the attached are satisfactory > - test.org: just a heading, a couple lists, R code (and output), and an image > - test.Rmd: output of ox-ravel Rmd exporter > - test.html (well, a screenshot): results of opening test.Rmd in > RStudio and knitting > Thanks for the example. Best, Chuck --0-1803618260-1414888622=:4424--