(let ((counter 0)) (defun ox-mrkup-filter-src-block (text back-end info) (let* ((url (save-nth-src-block counter (plist-get info :parse-tree))) (output (format "%s Open the code " text url))) (setq counter (+ counter 1)) output)) (let ((org-export-filter-src-block-functions '(ox-mrkup-filter-src-block)) (async nil) (subtreep nil) (visible-only nil) (body-only t) (ext-plist '())) (org-html-export-as-html async subtreep visible-only body-only ext-plist)) ; now get the output into the org output (switch-to-buffer "*Org HTML Export*") (setq HTML (buffer-string))) (setq YAML "--- title: Customizing export of code blocks in HTML date: 2013/09/28 10:45:00 categories: org-mode --- ") (with-temp-buffer (insert YAML) (insert HTML) (write-region (point-min) (point-max) "../_posts/2013-09-28-Customizing-export-of-code-blocks-in-HTML.html")) (princ "Done.")