summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaushal Modi <kaushal.modi@gmail.com>2017-12-20 13:01:06 -0500
committerKaushal Modi <kaushal.modi@gmail.com>2017-12-20 13:18:55 -0500
commit4f3fc9cb20dc242a4b41b834e68b9ee554554307 (patch)
tree98647cc95a7ae7d1f427750c7ef40093ffb01060
parent3acc212c8ff76665cc16726bd71811a8ca089950 (diff)
downloadorg-mode-4f3fc9cb20dc242a4b41b834e68b9ee554554307.tar.gz
Fix double-escaping of # and ![ in Markdown export
* lisp/ox-md.el (org-md-plain-text): Fix the order of replacements in plain text. <http://lists.gnu.org/r/emacs-orgmode/2017-12/msg00460.html>
-rw-r--r--lisp/ox-md.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 1218838..927a73b 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -500,14 +500,15 @@ TEXT is the string to transcode. INFO is a plist holding
contextual information."
(when (plist-get info :with-smart-quotes)
(setq text (org-export-activate-smart-quotes text :html info)))
+ ;; The below series of replacements in `text' is order sensitive.
+ ;; Protect `, *, _, and \
+ (setq text (replace-regexp-in-string "[`*_\\]" "\\\\\\&" text))
;; 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 \
- (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)))