From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: How to use org src functions in other major mode (markdow)? Date: Wed, 1 Jan 2014 02:58:49 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyC1d-0004XW-II for emacs-orgmode@gnu.org; Tue, 31 Dec 2013 21:59:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VyC1X-0008Pe-NQ for emacs-orgmode@gnu.org; Tue, 31 Dec 2013 21:59:17 -0500 Received: from plane.gmane.org ([80.91.229.3]:59058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyC1X-0008Pa-Fl for emacs-orgmode@gnu.org; Tue, 31 Dec 2013 21:59:11 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VyC1W-0000pP-7r for emacs-orgmode@gnu.org; Wed, 01 Jan 2014 03:59:10 +0100 Received: from 137.110.37.240 ([137.110.37.240]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jan 2014 03:59:10 +0100 Received: from ccberry by 137.110.37.240 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jan 2014 03:59:10 +0100 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: emacs-orgmode@gnu.org 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

# 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

# header 1 ```r a <- 1 b <- 2 a + b ``` ``` ## [1] 3 ``` --8<---------------cut here---------------end--------------->8--- HTH, Chuck