org-mode/lisp/ox-md.el

573 lines
19 KiB
EmacsLisp
Raw Normal View History

;;; ox-md.el --- Markdown Back-End for Org Export Engine
;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
;; Keywords: org, wp, markdown
Backport changes from Emacs revs 115081 and 115082 2013-11-12 Stefan Monnier <monnier@iro.umontreal.ca> Address some byte-compiler warnings. * ob-abc.el (org-babel-expand-body:abc): Use dolist. (org-babel-execute:abc): Fix regexp quoting. * ob-calc.el (org--var-syms): Rename from `var-syms'. * ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding. * ob-table.el (sbe): Move debug declaration. * org-clock.el (org--msg-extra): Rename from `msg-extra'. * org.el (org-version): Avoid var name starting with _. (org-inhibit-startup, org-called-with-limited-levels) (org-link-search-inhibit-query, org-time-was-given) (org-end-time-was-given, org-def, org-defdecode, org-with-time): * org-colview.el (org-agenda-overriding-columns-format): * org-agenda.el (org-agenda-multi, org-depend-tag-blocked) (org-agenda-show-log-scoped): * ob-python.el (py-which-bufname, python-shell-buffer-name): * ob-haskell.el (org-export-copy-to-kill-ring): * ob-exp.el (org-link-search-inhibit-query): * ob-R.el (ess-eval-visibly-p): * ob-core.el (org-src-window-setup): Declare before use. (org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'. * ox-odt.el (org-odt-hfy-face-to-css): * org-src.el (org-src-associate-babel-session, org-src-get-lang-mode): * org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex) (org-bibtex-check): * ob-tangle.el (org-babel-tangle, org-babel-spec-to-string) (org-babel-tangle-single-block, org-babel-tangle-comment-links): * ob-table.el (sbe): * ob-sqlite.el (org-babel-sqlite-expand-vars): * ob-sql.el (org-babel-sql-expand-vars): * ob-shen.el (org-babel-execute:shen): * ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate): * ob-scala.el (org-babel-scala-evaluate): * ob-ruby.el (org-babel-ruby-table-or-string) (org-babel-ruby-evaluate): * ob-python.el (org-babel-python-table-or-string) (org-babel-python-evaluate-external-process) (org-babel-python-evaluate-session): * ob-picolisp.el (org-babel-execute:picolisp): * ob-perl.el (org-babel-perl-evaluate): * ob-maxima.el (org-babel-execute:maxima): * ob-lisp.el (org-babel-execute:lisp): * ob-java.el (org-babel-execute:java): * ob-io.el (org-babel-io-evaluate): * ob-haskell.el (org-babel-execute:haskell): * ob-fortran.el (org-babel-execute:fortran): * ob-exp.el (org-babel-exp-code): * ob-emacs-lisp.el (org-babel-execute:emacs-lisp): * ob-ditaa.el (org-babel-execute:ditaa): * ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash) (org-babel-parse-header-arguments, org-babel-reassemble-table) (org-babel-goto-src-block-head, org-babel-mark-block) (org-babel-expand-noweb-references, org-babel-script-escape) (org-babel-process-file-name): * ob-clojure.el (org-babel-execute:clojure): * ob-calc.el (org-babel-execute:calc): * ob-awk.el (org-babel-execute:awk): * ob-abc.el (org-babel-execute:abc): * ob-R.el (org-babel-expand-body:R): * ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...). 2013-11-12 Glenn Morris <rgm@gnu.org> * ox-html.el (org-html-scripts): Add 2013 to copyright years. (org-html-infojs-template): Copyright holder to FSF.
2013-11-12 14:57:31 -05:00
;; This file is part of GNU Emacs.
2013-02-23 03:56:24 -05:00
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
2013-02-23 03:56:24 -05:00
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
2013-02-23 03:56:24 -05:00
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This library implements a Markdown back-end (vanilla flavor) for
;; Org exporter, based on `html' back-end. See Org manual for more
;; information.
;;; Code:
(eval-when-compile (require 'cl))
(require 'ox-html)
(require 'ox-publish)
;;; User-Configurable Variables
(defgroup org-export-md nil
"Options specific to Markdown export back-end."
:tag "Org Markdown"
:group 'org-export
:version "24.4"
:package-version '(Org . "8.0"))
(defcustom org-md-headline-style 'atx
"Style used to format headlines.
This variable can be set to either `atx' or `setext'."
:group 'org-export-md
:type '(choice
(const :tag "Use \"atx\" style" atx)
(const :tag "Use \"Setext\" style" setext)))
;;; Define Back-End
(org-export-define-derived-backend 'md 'html
:export-block '("MD" "MARKDOWN")
:filters-alist '((:filter-parse-tree . org-md-separate-elements))
:menu-entry
'(?m "Export to Markdown"
((?M "To temporary buffer"
(lambda (a s v b) (org-md-export-as-markdown a s v)))
(?m "To file" (lambda (a s v b) (org-md-export-to-markdown a s v)))
(?o "To file and open"
(lambda (a s v b)
(if a (org-md-export-to-markdown t s v)
(org-open-file (org-md-export-to-markdown nil s v)))))))
:translate-alist '((bold . org-md-bold)
(code . org-md-verbatim)
(comment . (lambda (&rest args) ""))
(comment-block . (lambda (&rest args) ""))
(example-block . org-md-example-block)
(export-block . org-md-export-block)
(fixed-width . org-md-example-block)
(footnote-definition . ignore)
(footnote-reference . ignore)
(headline . org-md-headline)
(horizontal-rule . org-md-horizontal-rule)
(inline-src-block . org-md-verbatim)
(inner-template . org-md-inner-template)
(italic . org-md-italic)
(item . org-md-item)
(keyword . org-md-keyword)
(line-break . org-md-line-break)
(link . org-md-link)
(node-property . org-md-node-property)
(paragraph . org-md-paragraph)
(plain-list . org-md-plain-list)
(plain-text . org-md-plain-text)
(property-drawer . org-md-property-drawer)
(quote-block . org-md-quote-block)
(section . org-md-section)
(src-block . org-md-example-block)
(template . org-md-template)
(verbatim . org-md-verbatim))
:options-alist '((:md-headline-style nil nil org-md-headline-style)))
;;; Filters
(defun org-md-separate-elements (tree backend info)
"Fix blank lines between elements.
TREE is the parse tree being exported. BACKEND is the export
back-end used. INFO is a plist used as a communication channel.
Enforce a blank line between elements. There are three
exceptions to this rule:
1. Preserve blank lines between sibling items in a plain list,
2. Outside of plain lists, preserve blank lines between
a paragraph and a plain list,
3. In an item, remove any blank line before the very first
paragraph and the next sub-list.
Assume BACKEND is `md'."
(org-element-map tree (remq 'item org-element-all-elements)
(lambda (e)
(cond
((not (and (eq (org-element-type e) 'paragraph)
(eq (org-element-type (org-export-get-next-element e info))
'plain-list)))
(org-element-put-property e :post-blank 1))
((not (eq (org-element-type (org-element-property :parent e)) 'item)))
(t (org-element-put-property
e :post-blank (if (org-export-get-previous-element e info) 1 0))))))
;; Return updated tree.
tree)
;;; Transcode Functions
;;;; Bold
(defun org-md-bold (bold contents info)
"Transcode BOLD object into Markdown format.
CONTENTS is the text within bold markup. INFO is a plist used as
a communication channel."
(format "**%s**" contents))
;;;; Code and Verbatim
(defun org-md-verbatim (verbatim contents info)
"Transcode VERBATIM object into Markdown format.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let ((value (org-element-property :value verbatim)))
(format (cond ((not (string-match "`" value)) "`%s`")
((or (string-match "\\``" value)
(string-match "`\\'" value))
"`` %s ``")
(t "``%s``"))
value)))
;;;; Example Block, Src Block and export Block
(defun org-md-example-block (example-block contents info)
"Transcode EXAMPLE-BLOCK element into Markdown format.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(replace-regexp-in-string
"^" " "
(org-remove-indentation
(org-export-format-code-default example-block info))))
(defun org-md-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to Markdown.
CONTENTS is nil. INFO is a plist holding contextual information."
(if (member (org-element-property :type export-block) '("MARKDOWN" "MD"))
(org-remove-indentation (org-element-property :value export-block))
;; Also include HTML export blocks.
(org-export-with-backend 'html export-block contents info)))
;;;; Headline
(defun org-md-headline (headline contents info)
"Transcode HEADLINE element into Markdown format.
CONTENTS is the headline contents. INFO is a plist used as
a communication channel."
(unless (org-element-property :footnote-section-p headline)
(let* ((level (org-export-get-relative-level headline info))
(title (org-export-data (org-element-property :title headline) info))
(todo (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword
headline)))
(and todo (concat (org-export-data todo info) " ")))))
(tags (and (plist-get info :with-tags)
(let ((tag-list (org-export-get-tags headline info)))
(and tag-list
(format " :%s:"
(mapconcat 'identity tag-list ":"))))))
(priority
(and (plist-get info :with-priority)
(let ((char (org-element-property :priority headline)))
(and char (format "[#%c] " char)))))
(anchor
(when (plist-get info :with-toc)
(org-html--anchor
(or (org-element-property :CUSTOM_ID headline)
(concat "sec-"
(mapconcat 'number-to-string
(org-export-get-headline-number
ox-html: Use options instead of hard-coded variables * contrib/lisp/ox-s5.el (org-s5--format-toc-headline): Apply signature change. * lisp/ox-md.el (org-md-headline): Apply signature change. * lisp/ox-html.el (org-html-format-drawer-function, org-html-publish-to-html): Small reformatting. (org-html-infojs-install-script, org-html--build-meta-info, org-html--build-mathjax-config, org-html-format-spec, org-html--build-pre/postamble, org-html-template, org-html-toc, org-html--format-toc-headline, org-html-list-of-listings, org-html-list-of-tables, org-html-bold, org-html-drawer, org-html-headline, org-html-inlinetask, org-html-italic, org-html-checkbox, org-html-inline-image-p, org-html-link, org-html-section, org-html-strike-through, org-html-table-cell, org-html-table-row, org-html-underline, org-html-verbatim, org-html-final-function, org-html-export-to-html): Do not use hard-coded variable names. (org-html-format-headline-function, org-html-format-inlinetask-function): Change default value. Require an additional argument. (org-html-format-footnote-reference, org-html-format-footnotes-section, org-html-format-footnote-definition, org-html-format-headline, org-html-format-headline--wrap, org-html-format-section): Remove functions. (org-html-footnote-section, org-html-footnote-reference): Apply function removal. Do not use hard-coded variable names. (org-html--anchor, org-html--todo, org-html--tags): Change signature. Do not use hard-coded variable names. (org-html-radio-target, org-html-target): Apply signature change. (org-html-format-headline-default-function, org-html-format-inlinetask-default-function): New functions.
2014-07-29 08:42:15 -04:00
headline info) "-")))
nil nil info)))
;; Headline text without tags.
(heading (concat todo priority title))
(style (plist-get info :md-headline-style)))
(cond
2013-02-23 07:47:44 -05:00
;; Cannot create a headline. Fall-back to a list.
((or (org-export-low-level-p headline info)
(not (memq style '(atx setext)))
(and (eq style 'atx) (> level 6))
(and (eq style 'setext) (> level 2)))
(let ((bullet
(if (not (org-export-numbered-headline-p headline info)) "-"
(concat (number-to-string
(car (last (org-export-get-headline-number
headline info))))
"."))))
(concat bullet (make-string (- 4 (length bullet)) ? ) heading tags
"\n\n"
(and contents
(replace-regexp-in-string "^" " " contents)))))
;; Use "Setext" style.
((eq style 'setext)
(concat heading tags anchor "\n"
(make-string (length heading) (if (= level 1) ?= ?-))
"\n\n"
contents))
;; Use "atx" style.
(t (concat (make-string level ?#) " " heading tags anchor "\n\n" contents))))))
;;;; Horizontal Rule
(defun org-md-horizontal-rule (horizontal-rule contents info)
"Transcode HORIZONTAL-RULE element into Markdown format.
CONTENTS is the horizontal rule contents. INFO is a plist used
as a communication channel."
"---")
;;;; Italic
(defun org-md-italic (italic contents info)
"Transcode ITALIC object into Markdown format.
CONTENTS is the text within italic markup. INFO is a plist used
as a communication channel."
(format "*%s*" contents))
;;;; Item
(defun org-md-item (item contents info)
"Transcode ITEM element into Markdown format.
CONTENTS is the item contents. INFO is a plist used as
a communication channel."
(let* ((type (org-element-property :type (org-export-get-parent item)))
(struct (org-element-property :structure item))
(bullet (if (not (eq type 'ordered)) "-"
(concat (number-to-string
(car (last (org-list-get-item-number
(org-element-property :begin item)
struct
(org-list-prevs-alist struct)
(org-list-parents-alist struct)))))
"."))))
(concat bullet
(make-string (- 4 (length bullet)) ? )
(case (org-element-property :checkbox item)
(on "[X] ")
(trans "[-] ")
(off "[ ] "))
(let ((tag (org-element-property :tag item)))
(and tag (format "**%s:** "(org-export-data tag info))))
(and contents
(org-trim (replace-regexp-in-string "^" " " contents))))))
;;;; Keyword
(defun org-md-keyword (keyword contents info)
"Transcode a KEYWORD element into Markdown format.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(if (member (org-element-property :key keyword) '("MARKDOWN" "MD"))
(org-element-property :value keyword)
(org-export-with-backend 'html keyword contents info)))
;;;; Line Break
(defun org-md-line-break (line-break contents info)
"Transcode LINE-BREAK object into Markdown format.
CONTENTS is nil. INFO is a plist used as a communication
channel."
" \n")
;;;; Link
(defun org-md-link (link contents info)
"Transcode LINE-BREAK object into Markdown format.
CONTENTS is the link's description. INFO is a plist used as
a communication channel."
(let ((link-org-files-as-md
(function
(lambda (raw-path)
;; Treat links to `file.org' as links to `file.md'.
(if (string= ".org" (downcase (file-name-extension raw-path ".")))
(concat (file-name-sans-extension raw-path) ".md")
raw-path))))
(type (org-element-property :type link)))
(cond
((member type '("custom-id" "id"))
(let ((destination (org-export-resolve-id-link link info)))
(if (stringp destination) ; External file.
(let ((path (funcall link-org-files-as-md destination)))
(if (not contents) (format "<%s>" path)
(format "[%s](%s)" contents path)))
(concat
(and contents (concat contents " "))
(format "(%s)"
(format (org-export-translate "See section %s" :html info)
(mapconcat 'number-to-string
(org-export-get-headline-number
destination info)
".")))))))
((org-export-inline-image-p link org-html-inline-image-rules)
(let ((path (let ((raw-path (org-element-property :path link)))
(if (not (file-name-absolute-p raw-path)) raw-path
(expand-file-name raw-path))))
(caption (org-export-data
(org-export-get-caption
(org-export-get-parent-element link)) info)))
(format "![img](%s)"
(if (not (org-string-nw-p caption)) path
(format "%s \"%s\"" path caption)))))
((string= type "coderef")
(let ((ref (org-element-property :path link)))
(format (org-export-get-coderef-format ref contents)
(org-export-resolve-coderef ref info))))
((equal type "radio") contents)
((equal type "fuzzy")
(let ((destination (org-export-resolve-fuzzy-link link info)))
(if (org-string-nw-p contents) contents
(when destination
(let ((number (org-export-get-ordinal destination info)))
(when number
(if (atom number) (number-to-string number)
(mapconcat 'number-to-string number "."))))))))
;; Link type is handled by a special function.
((let ((protocol (nth 2 (assoc type org-link-protocols))))
(and (functionp protocol)
(funcall protocol
(org-link-unescape (org-element-property :path link))
contents
'md))))
(t (let* ((raw-path (org-element-property :path link))
(path
(cond
((member type '("http" "https" "ftp"))
(concat type ":" raw-path))
((string= type "file")
(let ((path (funcall link-org-files-as-md raw-path)))
(if (not (file-name-absolute-p path)) path
;; If file path is absolute, prepend it
;; with "file:" component.
(concat "file:" path))))
(t raw-path))))
(if (not contents) (format "<%s>" path)
(format "[%s](%s)" contents path)))))))
;;;; Node Property
(defun org-md-node-property (node-property contents info)
"Transcode a NODE-PROPERTY element into Markdown syntax.
CONTENTS is nil. INFO is a plist holding contextual
information."
(format "%s:%s"
(org-element-property :key node-property)
(let ((value (org-element-property :value node-property)))
(if value (concat " " value) ""))))
;;;; Paragraph
(defun org-md-paragraph (paragraph contents info)
"Transcode PARAGRAPH element into Markdown format.
CONTENTS is the paragraph contents. INFO is a plist used as
a communication channel."
(let ((first-object (car (org-element-contents paragraph))))
;; If paragraph starts with a #, protect it.
(if (and (stringp first-object) (string-match "\\`#" first-object))
(replace-regexp-in-string "\\`#" "\\#" contents nil t)
contents)))
;;;; Plain List
(defun org-md-plain-list (plain-list contents info)
"Transcode PLAIN-LIST element into Markdown format.
CONTENTS is the plain-list contents. INFO is a plist used as
a communication channel."
contents)
;;;; Plain Text
(defun org-md-plain-text (text info)
"Transcode a TEXT string into Markdown format.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
2012-10-26 18:36:00 -04:00
(when (plist-get info :with-smart-quotes)
(setq text (org-export-activate-smart-quotes text :html info)))
;; Protect ambiguous #. This will protect # at the beginning of
;; a line, but not at the beginning of a paragraph. See
;; `org-md-paragraph'.
(setq text (replace-regexp-in-string "\n#" "\n\\\\#" text))
;; Protect ambiguous !
(setq text (replace-regexp-in-string "\\(!\\)\\[" "\\\\!" text nil nil 1))
;; Protect `, *, _ and \
2012-10-26 18:36:00 -04:00
(setq text (replace-regexp-in-string "[`*_\\]" "\\\\\\&" text))
;; Handle special strings, if required.
(when (plist-get info :with-special-strings)
(setq text (org-html-convert-special-strings text)))
;; Handle break preservation, if required.
(when (plist-get info :preserve-breaks)
(setq text (replace-regexp-in-string "[ \t]*\n" " \n" text)))
;; Return value.
text)
;;;; Property Drawer
(defun org-md-property-drawer (property-drawer contents info)
"Transcode a PROPERTY-DRAWER element into Markdown format.
CONTENTS holds the contents of the drawer. INFO is a plist
holding contextual information."
(and (org-string-nw-p contents)
(replace-regexp-in-string "^" " " contents)))
;;;; Quote Block
(defun org-md-quote-block (quote-block contents info)
"Transcode QUOTE-BLOCK element into Markdown format.
CONTENTS is the quote-block contents. INFO is a plist used as
a communication channel."
(replace-regexp-in-string
"^" "> "
(replace-regexp-in-string "\n\\'" "" contents)))
;;;; Section
(defun org-md-section (section contents info)
"Transcode SECTION element into Markdown format.
CONTENTS is the section contents. INFO is a plist used as
a communication channel."
contents)
;;;; Template
(defun org-md-inner-template (contents info)
"Return body of document after converting it to Markdown syntax.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
;; Make sure CONTENTS is separated from table of contents and
;; footnotes with at least a blank line.
(org-trim (org-html-inner-template (concat "\n" contents "\n") info)))
(defun org-md-template (contents info)
"Return complete document string after Markdown conversion.
CONTENTS is the transcoded contents string. INFO is a plist used
as a communication channel."
contents)
;;; Interactive function
;;;###autoload
(defun org-md-export-as-markdown (&optional async subtreep visible-only)
"Export current buffer to a Markdown buffer.
If narrowing is active in the current buffer, only export its
narrowed part.
If a region is active, export that region.
A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting buffer should be accessible
through the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
Export is done in a buffer named \"*Org MD Export*\", which will
be displayed when `org-export-show-temporary-export-buffer' is
non-nil."
(interactive)
Export back-ends: Apply changes to export functions * contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence): * contrib/lisp/ox-deck.el (org-deck-export-as-html, org-deck-export-to-html): * contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind): * contrib/lisp/ox-groff.el (org-groff-export-to-groff, org-groff-export-to-pdf): * contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex, org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf): * contrib/lisp/ox-rss.el (org-rss-export-as-rss, org-rss-export-to-rss): * contrib/lisp/ox-s5.el (org-s5-export-as-html, org-s5-export-to-html): * contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export): * lisp/ob-haskell.el: * lisp/ox-ascii.el (org-ascii-export-as-ascii, org-ascii-export-to-ascii): * lisp/ox-beamer.el (org-beamer-export-as-latex, org-beamer-export-to-latex, org-beamer-export-to-pdf): * lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html): * lisp/ox-icalendar.el (org-icalendar-export-to-ics): * lisp/ox-latex.el (org-latex-export-as-latex, org-latex-export-to-pdf): * lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf): * lisp/ox-md.el (org-md-export-as-markdown, org-md-export-to-markdown): * lisp/ox-odt.el (org-odt-export-to-odt): * lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org): * lisp/ox-publish.el (org-publish-org-to): * lisp/ox-texinfo.el (org-texinfo-export-to-texinfo, org-texinfo-export-to-info): * testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
(org-export-to-buffer 'md "*Org MD Export*"
async subtreep visible-only nil nil (lambda () (text-mode))))
;;;###autoload
(defun org-md-convert-region-to-md ()
"Assume the current region has org-mode syntax, and convert it to Markdown.
This can be used in any buffer. For example, you can write an
itemized list in org-mode syntax in a Markdown buffer and use
this command to convert it."
(interactive)
(org-export-replace-region-by 'md))
;;;###autoload
(defun org-md-export-to-markdown (&optional async subtreep visible-only)
"Export current buffer to a Markdown file.
If narrowing is active in the current buffer, only export its
narrowed part.
If a region is active, export that region.
A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting file should be accessible through
the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".md" subtreep)))
Export back-ends: Apply changes to export functions * contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence): * contrib/lisp/ox-deck.el (org-deck-export-as-html, org-deck-export-to-html): * contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind): * contrib/lisp/ox-groff.el (org-groff-export-to-groff, org-groff-export-to-pdf): * contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex, org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf): * contrib/lisp/ox-rss.el (org-rss-export-as-rss, org-rss-export-to-rss): * contrib/lisp/ox-s5.el (org-s5-export-as-html, org-s5-export-to-html): * contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export): * lisp/ob-haskell.el: * lisp/ox-ascii.el (org-ascii-export-as-ascii, org-ascii-export-to-ascii): * lisp/ox-beamer.el (org-beamer-export-as-latex, org-beamer-export-to-latex, org-beamer-export-to-pdf): * lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html): * lisp/ox-icalendar.el (org-icalendar-export-to-ics): * lisp/ox-latex.el (org-latex-export-as-latex, org-latex-export-to-pdf): * lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf): * lisp/ox-md.el (org-md-export-as-markdown, org-md-export-to-markdown): * lisp/ox-odt.el (org-odt-export-to-odt): * lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org): * lisp/ox-publish.el (org-publish-org-to): * lisp/ox-texinfo.el (org-texinfo-export-to-texinfo, org-texinfo-export-to-info): * testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
(org-export-to-file 'md outfile async subtreep visible-only)))
;;;###autoload
(defun org-md-publish-to-md (plist filename pub-dir)
"Publish an org file to Markdown.
FILENAME is the filename of the Org file to be published. PLIST
is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
(org-publish-org-to 'md filename ".md" plist pub-dir))
(provide 'ox-md)
;; Local variables:
;; generated-autoload-file: "org-loaddefs.el"
;; End:
;;; ox-md.el ends here