emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Anyone using or interested in an org to Rmarkdown exporter?
@ 2014-10-30 16:37 Grant Rettke
  2014-11-01 10:37 ` Thorsten Jolitz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Grant Rettke @ 2014-10-30 16:37 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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?
• Do you have any interest in such an exporter?
• Has anyone else ever thought of doing this? If yes, why didn't you?
• 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

Kind regards,


[RMarkdown] http://rmarkdown.rstudio.com/

[literate programming]
https://en.wikipedia.org/wiki/Literate_programming

[ℝ programming language] http://www.r-project.org/

[Markdown] http://daringfireball.net/projects/markdown/syntax

[vanilla markdown] http://orgmode.org/manual/Markdown-export.html

[GitHub flavored Markdown]
http://orgmode.org/cgit.cgi/org-mode.git/plain/contrib/lisp/ox-gfm.el

[builds on an existing exporter]
http://orgmode.org/manual/Adding-export-back_002dends.html

-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Anyone using or interested in an org to Rmarkdown exporter?
  2014-10-30 16:37 Anyone using or interested in an org to Rmarkdown exporter? Grant Rettke
@ 2014-11-01 10:37 ` Thorsten Jolitz
  2014-11-01 14:37 ` Rasmus
       [not found] ` <CA+M2ft_pi=dMOQd0fju_4kN=gsG=eq9YTunP_PHRuQ=rWyjZHA@mail.gmail.com>
  2 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-11-01 10:37 UTC (permalink / raw)
  To: emacs-orgmode

Grant Rettke <gcr@wisdomandwonder.com> writes:

Hi Grant,

> 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?
> • Do you have any interest in such an exporter?
> • Has anyone else ever thought of doing this? If yes, why didn't you?
> • 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
>
> Kind regards,

what would acutally be the benefit of using RMarkdown over Org-mode, or
put it another way - when you already use RMarkdown, why do you need
Org-mode too? And if you use Org-mode, what does RMarkdown add to the
table? 

And then there is Outshine too, which lets you switch seemlessly switch
between ESS[R] and Org-mode, so you can program in R-mode, and write and
export in Org-ode, as well as other LP modes like the old (now
overhauled) ESS multi-mode and a new multi-mode developed by Phillip
Lord, so one needs reasons to add just another tool to the tool stack IMO.

> [RMarkdown] http://rmarkdown.rstudio.com/
>
> [literate programming]
> https://en.wikipedia.org/wiki/Literate_programming
>
> [ℝ programming language] http://www.r-project.org/
>
> [Markdown] http://daringfireball.net/projects/markdown/syntax
>
> [vanilla markdown] http://orgmode.org/manual/Markdown-export.html
>
> [GitHub flavored Markdown]
> http://orgmode.org/cgit.cgi/org-mode.git/plain/contrib/lisp/ox-gfm.el
>
> [builds on an existing exporter]
> http://orgmode.org/manual/Adding-export-back_002dends.html

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Anyone using or interested in an org to Rmarkdown exporter?
  2014-10-30 16:37 Anyone using or interested in an org to Rmarkdown exporter? Grant Rettke
  2014-11-01 10:37 ` Thorsten Jolitz
@ 2014-11-01 14:37 ` Rasmus
  2014-11-01 17:31   ` Charles C. Berry
       [not found] ` <CA+M2ft_pi=dMOQd0fju_4kN=gsG=eq9YTunP_PHRuQ=rWyjZHA@mail.gmail.com>
  2 siblings, 1 reply; 8+ messages in thread
From: Rasmus @ 2014-11-01 14:37 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Grant Rettke <gcr@wisdomandwonder.com> writes:

> • Does one exist and I missed it?

Are you aware of this project?

    https://github.com/chasberry/orgmode-accessories

—Rasmus

-- 
Dobbelt-A

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Fwd: Anyone using or interested in an org to Rmarkdown exporter?
       [not found] ` <CA+M2ft_pi=dMOQd0fju_4kN=gsG=eq9YTunP_PHRuQ=rWyjZHA@mail.gmail.com>
@ 2014-11-01 17:21   ` John Hendy
  2014-11-02  0:37     ` Charles C. Berry
  0 siblings, 1 reply; 8+ messages in thread
From: John Hendy @ 2014-11-01 17:21 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2851 bytes --]

Whoops -- missed the reply-all on this!

John


---------- Forwarded message ----------
From: John Hendy <jw.hendy@gmail.com>
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 <gcr@wisdomandwonder.com>


On Thu, Oct 30, 2014 at 11:37 AM, Grant Rettke <gcr@wisdomandwonder.com> 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, and it appears knittr won't pick up a list if
there's no blank line between regular text and a list. In other words,
this:

list
- item1
- item2

Isn't the same as this:

list

- item1
- item2

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).

> • 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


Let me know what you think!
John

[-- Attachment #2: 2014-10-31_192325.png --]
[-- Type: image/png, Size: 70266 bytes --]

[-- Attachment #3: test.org --]
[-- Type: application/octet-stream, Size: 252 bytes --]

#+setupfile: "~/org/aux/setupfile.org"

* test

Unordered list

- How does this work?
- Simple list
- 'Nother item


Numbered list

1) Switch it up
2) Numbers this time

Some code:

#+begin_src R

x <- 1:10
y <- x^2

y
#+end_src

Image?

[[./tux.png]]

[-- Attachment #4: test.Rmd --]
[-- Type: text/x-r-markdown, Size: 209 bytes --]

# test

Unordered list

-   How does this work?
-   Simple list
-   'Nother item

Numbered list

1.  Switch it up
2.  Numbers this time

Some code:

```{r }
x <- 1:10
y <- x^2

y
```

Image?

![img](./tux.png)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Anyone using or interested in an org to Rmarkdown exporter?
  2014-11-01 14:37 ` Rasmus
@ 2014-11-01 17:31   ` Charles C. Berry
  2014-11-01 17:42     ` Thorsten Jolitz
  2014-11-05  1:23     ` Grant Rettke
  0 siblings, 2 replies; 8+ messages in thread
From: Charles C. Berry @ 2014-11-01 17:31 UTC (permalink / raw)
  To: Rasmus, Grant Rettke; +Cc: emacs-orgmode

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1551 bytes --]

On Sat, 1 Nov 2014, Rasmus wrote:

> Hello,
>
> Grant Rettke <gcr@wisdomandwonder.com> writes:
>
>> • Does one exist and I missed it?
>
> Are you aware of this project?
>
>    https://github.com/chasberry/orgmode-accessories
>
> —Rasmus


Thanks for this, Rasmus.

Grant,

If ox-ravel is something you are interested, I recommend that you
tryout the `ravel-lang' branch. In addition to the examples in the
master branch, there is `demos.org' with some simple examples.

As to Thorsten's query:

,----
| what would acutally be the benefit of using RMarkdown over Org-mode,
| or put it another way - when you already use RMarkdown, why do you
| need Org-mode too? And if you use Org-mode, what does RMarkdown add to
| the table?
`----

There is some discussion of this in the README.org...

If you already use org-mode:

You get access to Sweave, knitr, slidify, pander, et cetera.

Their `chunk' options (akin to babel header args) can be easier to use
than header args for complicated displays.

Dependency aware caching of R objects is available in those engines and 
its lack in Babel [1] is a serious impediment to working with long running 
computations.

bioConductor vignettes can be authored in org-mode and exported for a
suitable vignette engine.

If you already use Rmarkdown, etc, you get the ease of editting and
working in org-mode - cycling visibility of headlines, lists, src
blocks, and results, and of storing results inline, previewing latex
fragments, and all.

HTH,

Chuck

[1] Yes, I do know that there is a :cache header arg.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Anyone using or interested in an org to Rmarkdown exporter?
  2014-11-01 17:31   ` Charles C. Berry
@ 2014-11-01 17:42     ` Thorsten Jolitz
  2014-11-05  1:23     ` Grant Rettke
  1 sibling, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-11-01 17:42 UTC (permalink / raw)
  To: emacs-orgmode

"Charles C. Berry" <ccberry@ucsd.edu> writes:

> As to Thorsten's query:
>
> ,----
> | what would acutally be the benefit of using RMarkdown over Org-mode,
> | or put it another way - when you already use RMarkdown, why do you
> | need Org-mode too? And if you use Org-mode, what does RMarkdown add to
> | the table?
> `----
>
> There is some discussion of this in the README.org...
>
> If you already use org-mode:
>
> You get access to Sweave, knitr, slidify, pander, et cetera.
>
> Their `chunk' options (akin to babel header args) can be easier to use
> than header args for complicated displays.
>
> Dependency aware caching of R objects is available in those engines
> and its lack in Babel [1] is a serious impediment to working with long
> running computations.
>
> bioConductor vignettes can be authored in org-mode and exported for a
> suitable vignette engine.
>
> If you already use Rmarkdown, etc, you get the ease of editting and
> working in org-mode - cycling visibility of headlines, lists, src
> blocks, and results, and of storing results inline, previewing latex
> fragments, and all.
>
> HTH,

Yes, definitely, thanks for the info. So it makes sense to add another
tool ;)

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fwd: Anyone using or interested in an org to Rmarkdown exporter?
  2014-11-01 17:21   ` Fwd: " John Hendy
@ 2014-11-02  0:37     ` Charles C. Berry
  0 siblings, 0 replies; 8+ messages in thread
From: Charles C. Berry @ 2014-11-02  0:37 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3906 bytes --]

On Sat, 1 Nov 2014, John Hendy wrote:

[snip]
> From: John Hendy <jw.hendy@gmail.com>
> 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 <gcr@wisdomandwonder.com>
>
>
> On Thu, Oct 30, 2014 at 11:37 AM, Grant Rettke <gcr@wisdomandwonder.com> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Anyone using or interested in an org to Rmarkdown exporter?
  2014-11-01 17:31   ` Charles C. Berry
  2014-11-01 17:42     ` Thorsten Jolitz
@ 2014-11-05  1:23     ` Grant Rettke
  1 sibling, 0 replies; 8+ messages in thread
From: Grant Rettke @ 2014-11-05  1:23 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode@gnu.org, Rasmus

Will do and thanks for the info Charles, John, Thorsten, and Rasmus.

On Sat, Nov 1, 2014 at 12:31 PM, Charles C. Berry <ccberry@ucsd.edu> wrote:
> On Sat, 1 Nov 2014, Rasmus wrote:
>
>> Hello,
>>
>> Grant Rettke <gcr@wisdomandwonder.com> writes:
>>
>>> • Does one exist and I missed it?
>>
>>
>> Are you aware of this project?
>>
>>    https://github.com/chasberry/orgmode-accessories
>>
>> —Rasmus
>
>
>
> Thanks for this, Rasmus.
>
> Grant,
>
> If ox-ravel is something you are interested, I recommend that you
> tryout the `ravel-lang' branch. In addition to the examples in the
> master branch, there is `demos.org' with some simple examples.
>
> As to Thorsten's query:
>
> ,----
> | what would acutally be the benefit of using RMarkdown over Org-mode,
> | or put it another way - when you already use RMarkdown, why do you
> | need Org-mode too? And if you use Org-mode, what does RMarkdown add to
> | the table?
> `----
>
> There is some discussion of this in the README.org...
>
> If you already use org-mode:
>
> You get access to Sweave, knitr, slidify, pander, et cetera.
>
> Their `chunk' options (akin to babel header args) can be easier to use
> than header args for complicated displays.
>
> Dependency aware caching of R objects is available in those engines and its
> lack in Babel [1] is a serious impediment to working with long running
> computations.
>
> bioConductor vignettes can be authored in org-mode and exported for a
> suitable vignette engine.
>
> If you already use Rmarkdown, etc, you get the ease of editting and
> working in org-mode - cycling visibility of headlines, lists, src
> blocks, and results, and of storing results inline, previewing latex
> fragments, and all.
>
> HTH,
>
> Chuck
>
> [1] Yes, I do know that there is a :cache header arg.



-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-05  1:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 16:37 Anyone using or interested in an org to Rmarkdown exporter? Grant Rettke
2014-11-01 10:37 ` Thorsten Jolitz
2014-11-01 14:37 ` Rasmus
2014-11-01 17:31   ` Charles C. Berry
2014-11-01 17:42     ` Thorsten Jolitz
2014-11-05  1:23     ` Grant Rettke
     [not found] ` <CA+M2ft_pi=dMOQd0fju_4kN=gsG=eq9YTunP_PHRuQ=rWyjZHA@mail.gmail.com>
2014-11-01 17:21   ` Fwd: " John Hendy
2014-11-02  0:37     ` Charles C. Berry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).