能否让 org-mode 导出为 html 时自动将图片转为 base64

这是我的配置,他的可以在启动的时候就自动执行那串语句,不用每次启动都执行一遍

(defun org-org-html--format-image (source attributes info)
  (format "<img src=\"data:image/%s;base64,%s\"%s />"
      (or (file-name-extension source) "")
      (base64-encode-string
       (with-temp-buffer
	 (insert-file-contents-literally source)
	 (buffer-string)))
      (file-name-nondirectory source)))
(advice-add #'org-html--format-image :override #'org-org-html--format-image)
1 个赞