>From a78dc91c9fd1aacb2c65f66ae5afa9ee25f56e01 Mon Sep 17 00:00:00 2001 From: thibault Date: Sun, 3 Dec 2017 17:42:13 -0600 Subject: [PATCH] Fix bug in HTML export of code blocks with starting blank lines * lisp/ox-html.el (org-html-do-format-code): Preverse starting blank lines when splitting code lines (use `split-string' instead of `org-split-string'). (org-html-fontify-code): Preserve starting blank lines in returned code string. --- lisp/ox-html.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 0e22c1699..90a6cede0 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2202,7 +2202,7 @@ https://github.com/hniksic/emacs-htmlize")) (org-html-htmlize-region-for-paste (point-min) (point-max)))))) ;; Strip any enclosing
 tags.
-	  (let* ((beg (and (string-match "\\`]*>\n*" code) (match-end 0)))
+	  (let* ((beg (and (string-match "\\`]*>\n?" code) (match-end 0)))
 		 (end (and beg (string-match "\\'" code))))
 	    (if (and beg end) (substring code beg end) code)))))))))
 
@@ -2215,7 +2215,7 @@ alist between line numbers and references (as returned by
 `org-export-unravel-code'), a boolean specifying if labels should
 appear in the source code, and the number associated to the first
 line of code."
-  (let* ((code-lines (org-split-string code "\n"))
+  (let* ((code-lines (split-string code "\n"))
 	 (code-length (length code-lines))
 	 (num-fmt
 	  (and num-start
-- 
2.14.1