-
-
Save mexisme/fafd3e8fd9c2a4f48a82a49c94aa39f0 to your computer and use it in GitHub Desktop.
org-to-gfm.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; org-to-gfm --- Export a org-mode file to Github-flavored Markdown | |
;;; | |
;;; Commentary: | |
;;; To convert INPUT_FILE.org and produce OUTPUT_FILE.md, run something like: | |
;;; | |
;;; emacs -q --no-splash --no-x-resources --batch --script org-to-gfm.el INPUT_FILE.org OUTPUT_FILE.md | |
;;; | |
;;; Code: | |
(unless (require 'use-package nil t) (package-install 'use-package)) | |
(require 'use-package) | |
(package-initialize) | |
(use-package ox-gfm :ensure t) | |
(setq-default indent-tabs-mode nil) | |
(setq-default require-final-newline 't) | |
(add-hook 'before-save-hook #'delete-trailing-whitespace) | |
(let ((input-file (car command-line-args-left)) | |
(output-file (cadr command-line-args-left))) | |
(with-current-buffer (find-file-noselect input-file) | |
(org-gfm-export-as-markdown) | |
;; write output-file relative to startup dir, not input-file location | |
(cd command-line-default-directory) | |
(write-file output-file))) | |
;;; org-to-gfm.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment