mirror of
https://github.com/larstvei/ox-gfm.git
synced 2024-11-26 09:38:31 +00:00
Trim excess newlines inside paragraphs
This commit is contained in:
parent
77447e8cd3
commit
ab47a28575
17
ox-gfm.el
17
ox-gfm.el
@ -56,6 +56,7 @@
|
|||||||
(if a (org-gfm-export-to-markdown t s v)
|
(if a (org-gfm-export-to-markdown t s v)
|
||||||
(org-open-file (org-gfm-export-to-markdown nil s v)))))))
|
(org-open-file (org-gfm-export-to-markdown nil s v)))))))
|
||||||
:translate-alist '((inner-template . org-gfm-inner-template)
|
:translate-alist '((inner-template . org-gfm-inner-template)
|
||||||
|
(paragraph . org-gfm-paragraph)
|
||||||
(strike-through . org-gfm-strike-through)
|
(strike-through . org-gfm-strike-through)
|
||||||
(src-block . org-gfm-src-block)
|
(src-block . org-gfm-src-block)
|
||||||
(table-cell . org-gfm-table-cell)
|
(table-cell . org-gfm-table-cell)
|
||||||
@ -66,6 +67,22 @@
|
|||||||
|
|
||||||
;;; Transcode Functions
|
;;; Transcode Functions
|
||||||
|
|
||||||
|
;;;; Paragraph
|
||||||
|
|
||||||
|
(defun org-gfm-paragraph (paragraph contents _info)
|
||||||
|
"Transcode PARAGRAPH element into Github Flavoured Markdown format.
|
||||||
|
CONTENTS is the paragraph contents. INFO is a plist used as a
|
||||||
|
communication channel."
|
||||||
|
(let ((contents
|
||||||
|
(concat (replace-regexp-in-string "\\\n" "" contents nil t)
|
||||||
|
"\n")))
|
||||||
|
(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))))
|
||||||
|
|
||||||
|
|
||||||
;;;; Src Block
|
;;;; Src Block
|
||||||
|
|
||||||
(defun org-gfm-src-block (src-block contents info)
|
(defun org-gfm-src-block (src-block contents info)
|
||||||
|
Loading…
Reference in New Issue
Block a user