help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Org to Markdown programmatically


From: Jean Louis
Subject: Re: Org to Markdown programmatically
Date: Tue, 4 May 2021 20:29:36 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* Colin Baxter <m43cap@yandex.com> [2021-05-04 13:24]:
> >>>>> Emanuel Berg via Users list for the GNU Emacs text editor 
> >>>>> <help-gnu-emacs@gnu.org> writes:
> 
>     > Jean Louis wrote:
>     >> As I am editing database strings, not files, I have to export
>     >> programmatically Org blobs into HTML.
> 
>     > See if pandoc can do this...
> 
> It can:
> 
> pandoc -o file.md file.org <RET>

It can, though in the context of Emacs the native Org converted to
Markdown markup with library ox-md and then processed with external
Discount Markdown is still faster than processing it alone with
external Pandoc to Markdown only.

Pandoc cannot handle all features of Org mode, it is let us say, good
to do that for other editors, it means every editor could use Org
style to convert it for example to HTML od EPUB, without Emacs.

https://pandoc.org/org.html

I find however that Pandoc is great tool for conversions of various
formats including processing and generation of HTML.

One really serious issue with Pandoc is that it is huge software
considering how many dependencies it has, including Haskell
compiler. I wonder if it is reproducible, as in 2016, it was not
possible to find C sources for it. Only Haskell that has to be
compiled with Haskell, older versions were somehow lost at the
time. Maybe something changed today.

(benchmark 100 
           (let ((pages (rcd-sql-list "SELECT pages_id FROM pages WHERE 
pages_pagetype = 11" cf-db)))
             (while pages
               (let* ((id (pop pages))
                      (body (rcd-sql-first (format "SELECT pages_content FROM 
pages WHERE pages_id = %s" id) cf-db)))
                 (setq text (rcd-pandoc-org-markdown body))))))

Elapsed time: 0.000016s

Processing Org pages with native Emacs appears much faster.

(benchmark 100 
           (let ((pages (rcd-sql-list "SELECT pages_id FROM pages WHERE 
pages_pagetype = 11" cf-db)))
             (while pages
               (let* ((id (pop pages))
                      (body (rcd-sql-first (format "SELECT pages_content FROM 
pages WHERE pages_id = %s" id) cf-db)))
                 (setq text (rcd-org-to-markdown-to-html body))))))

Elapsed time: 0.000007s



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]