Re: [O] How to use org src functions in other major mode (markdow)?

2013-12-31 Thread Charles Berry
Shuguang Sun  gmail.com> writes:


> Dear all,
> Is it possible to use org src functions in other major mode, e.g., 
> markddown-mode?
> In some extend markdown, source code can be put in to block, for example, 
> r-mode for R script```rx <- 1:10```
> Is it possible to highlight the block as org-block "#begion_src R"? How 
> to run org-edit-src-code on such markdown blocks?
> Best Regards,
> Shuguang Sun
> 


Shuguang,


I cannot tell if you want to move org-mode format to *.Rnd or vice versa.

If you work in org-mode, you can export to markdown. 

If you want to go from markdown to org-mode pandoc will do some of the work,
but the org-mode it produces needs further prettying up and the source code
blocks need work.

If you want to use org-mode documents to produce knitr markdown, you can
use ravel.

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


Here is an example. With a file like this:

--8<---cut here---start->8---

* header 1

#+NAME: markdown-block
#+BEGIN_SRC R
a <- 1
b <- 2
a+b
#+END_SRC

--8<---cut here---end--->8---


Ravel export will produce a  *.Rmd file like this:

--8<---cut here---start->8---

Table of Contents

b
1. header 1



# header 1

```{r markdown-block}
a <- 1
b <- 2
a+b
```
--8<---cut here---end--->8---


Which knitr will render as *.md like this:


--8<---cut here---start->8---

Table of Contents


1. header 1



# header 1


```r
a <- 1
b <- 2
a + b
```

```
## [1] 3
```

--8<---cut here---end--->8---


HTH,

Chuck





[O] How to use org src functions in other major mode (markdow)?

2013-12-30 Thread Shuguang Sun
Dear all,

Is it possible to use org src functions in other major mode, e.g.,
markddown-mode?

In some extend markdown, source code can be put in to block, for example,
r-mode for R script

```r
x <- 1:10
```

Is it possible to highlight the block as org-block "#begion_src R"? How to
run org-edit-src-code on such markdown blocks?

Best Regards,
Shuguang Sun