emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add org-md-src-block for src-block formater
@ 2020-08-27  5:26 Naoya Yamashita
  2020-08-27  5:34 ` Nicolas Goaziou
  2020-08-27 16:53 ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 2 replies; 4+ messages in thread
From: Naoya Yamashita @ 2020-08-27  5:26 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 710 bytes --]

Hi,
I found `ox-md` exporter drop src-block language information.
My patch fixes the behavior; to embed src-block language information
using markdown src block grammar.

1. Open some buffer
2. Tnsert below code
3. Turn on `org-mode`
4. `C-c C-e m M` (export as markdown in temp buffer)

## org source
```org
#+begin_src python
print(1 + 2)
#+end_src

#+begin_src emacs-lisp
(print "hello")
#+end_src

#+begin_src
something source code
#+end_src
```

## before
```markdown

# Table of Contents



    print(1 + 2)

    (print "hello")

    something source code

```

## after
```markdown

# Table of Contents



```python
print(1 + 2)
```

```emacs-lisp
(print "hello")
```

```
something source code
```

```

[-- Attachment #1.2: Type: text/html, Size: 1156 bytes --]

[-- Attachment #2: 0001-Add-org-md-src-block-for-src-block-formater.patch --]
[-- Type: application/x-patch, Size: 1718 bytes --]

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

* Re: [PATCH] Add org-md-src-block for src-block formater
  2020-08-27  5:26 [PATCH] Add org-md-src-block for src-block formater Naoya Yamashita
@ 2020-08-27  5:34 ` Nicolas Goaziou
  2020-08-27 13:21   ` Naoya Yamashita
  2020-08-27 16:53 ` Berry, Charles via General discussions about Org-mode.
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2020-08-27  5:34 UTC (permalink / raw)
  To: Naoya Yamashita; +Cc: emacs-orgmode

Hello,

Naoya Yamashita <conao3@gmail.com> writes:

> I found `ox-md` exporter drop src-block language information.
> My patch fixes the behavior.

This is a feature. "ox-md" exports to vanilla Markdown, which doesn't
support such syntax. You may want to use other back-ends, e.g.,
"ox-gfm".

Regards,
-- 
Nicolas Goaziou


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

* Re: [PATCH] Add org-md-src-block for src-block formater
  2020-08-27  5:34 ` Nicolas Goaziou
@ 2020-08-27 13:21   ` Naoya Yamashita
  0 siblings, 0 replies; 4+ messages in thread
From: Naoya Yamashita @ 2020-08-27 13:21 UTC (permalink / raw)
  To: Naoya Yamashita, emacs-orgmode

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

> This is a feature. "ox-md" exports to vanilla Markdown, which doesn't
> support such syntax. You may want to use other back-ends, e.g.,
> "ox-gfm".

Thanks for letting me know that. I would try it.

2020年8月27日(木) 14:34 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> Naoya Yamashita <conao3@gmail.com> writes:
>
> > I found `ox-md` exporter drop src-block language information.
> > My patch fixes the behavior.
>
> This is a feature. "ox-md" exports to vanilla Markdown, which doesn't
> support such syntax. You may want to use other back-ends, e.g.,
> "ox-gfm".
>
> Regards,
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1102 bytes --]

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

* Re: [PATCH] Add org-md-src-block for src-block formater
  2020-08-27  5:26 [PATCH] Add org-md-src-block for src-block formater Naoya Yamashita
  2020-08-27  5:34 ` Nicolas Goaziou
@ 2020-08-27 16:53 ` Berry, Charles via General discussions about Org-mode.
  1 sibling, 0 replies; 4+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2020-08-27 16:53 UTC (permalink / raw)
  To: Naoya Yamashita; +Cc: emacs-orgmode@gnu.org

You might want to browse the ox-ravel repository[1].

It provides a collection of exporters that support reformatting src blocks and inline src blocks for a variety of output formats (including markdown).

Basically, it will produce a derived backend that adds source block reformatting to whatever the parent backend provides.

It is aimed at R flavored exports (knitr, Rmarkdown, Sweave), but customizable. One can, for example, allow emacs-lisp and shell src blocks to execute during export, but format python, C++ and R blocks for markdown and subsequent processing. It is easy to apply to any markdown exporter

See ox-ravel.org for details on customization.

It has plenty of stops and whistles even without customization. Check out the examples, such as demos.org and markdown.org.


HTH,

Chuck  

[1] https://github.com/chasberry/orgmode-accessories/blob/org-9-plus/markdown.org

> On Aug 26, 2020, at 10:26 PM, Naoya Yamashita <conao3@gmail.com> wrote:
> 
> Hi,
> I found `ox-md` exporter drop src-block language information.
> My patch fixes the behavior; to embed src-block language information
> using markdown src block grammar.
> 
> 1. Open some buffer
> 2. Tnsert below code
> 3. Turn on `org-mode`
> 4. `C-c C-e m M` (export as markdown in temp buffer)
> 
> ## org source
> ```org
> #+begin_src python
> print(1 + 2)
> #+end_src
> 
> #+begin_src emacs-lisp
> (print "hello")
> #+end_src
> 
> #+begin_src
> something source code
> #+end_src
> ```
> 
> ## before
> ```markdown
> 
> # Table of Contents
> 
> 
> 
>     print(1 + 2)
> 
>     (print "hello")
> 
>     something source code
> 
> ```
> 
> ## after
> ```markdown
> 
> # Table of Contents
> 
> 
> 
> ```python
> print(1 + 2)
> ```
> 
> ```emacs-lisp
> (print "hello")
> ```
> 
> ```
> something source code
> ```
> 
> ```
> <0001-Add-org-md-src-block-for-src-block-formater.patch>




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

end of thread, other threads:[~2020-08-27 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-27  5:26 [PATCH] Add org-md-src-block for src-block formater Naoya Yamashita
2020-08-27  5:34 ` Nicolas Goaziou
2020-08-27 13:21   ` Naoya Yamashita
2020-08-27 16:53 ` Berry, Charles via General discussions about Org-mode.

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