I wanted to see how my files look like in ‘s graph view. Commence massive yak shave to recursively convert a folder of org files to markdown. Result below, pretty much a copy paste from here: Bulk Org-Mode to Github Flavored Markdown. (I didn’t bother with github flavoured markdown though).

In the process I discovered that pandoc doesn’t convert extensions of cross-file links, which was massively annoying.

;;;###autoload
(require 'org)

(defun dired-org-to-markdown ()
    (let ((files
               (append
                     (let ((default-directory "."))
                       (mapcar #'expand-file-name
                                       (file-expand-wildcards "**/*.org")))
                   (let ((default-directory "."))
                           (mapcar #'expand-file-name
                                     (file-expand-wildcards "*.org")))
                      )
                  ))
          (mapc
           (lambda (f)
              (with-current-buffer
                     (find-file-noselect f)
                        (org-md-export-to-markdown)))
          files))
      )

(dired-org-to-markdown)

Pop the above in a file called something like export.el, then run it with:

emacs --batch --load=export.el

Convert a folder of org files to markdown

Leave a Reply

Your email address will not be published. Required fields are marked *

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)