From b5ff6abb3005d51760695ef2485ca75b4895b2d4 Mon Sep 17 00:00:00 2001 From: luxick Date: Fri, 23 Oct 2020 07:31:21 +0200 Subject: [PATCH] org HTML export with embedded images --- README.org | 20 +++++++++++++++++++- org-theme.css | 5 ++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index a62e177..30deaee 100644 --- a/README.org +++ b/README.org @@ -558,7 +558,25 @@ This will make sure a self contained single HTML file is created. (add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook) #+END_SRC -** Org Mode Bling< +Include images in org files as base64 directly into the HTML +#+begin_src emacs-lisp + (defun replace-in-string (what with in) + (replace-regexp-in-string (regexp-quote what) with in nil 'literal)) + + (defun org-html--format-image (source attributes info) + (progn + (setq source (replace-in-string "%20" " " source)) + (format "" + (or (file-name-extension source) "") + (base64-encode-string + (with-temp-buffer + (insert-file-contents-literally source) + (buffer-string))) + (file-name-nondirectory source)) + )) +#+end_src + +** Org Mode Bling #+BEGIN_SRC emacs-lisp (use-package org-bullets :init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) diff --git a/org-theme.css b/org-theme.css index 8521f4f..39d12c8 100644 --- a/org-theme.css +++ b/org-theme.css @@ -392,7 +392,7 @@ h2 { } .title { - margin: 0 0 2em 0; + margin: 0 0 0.8em 0; line-height: 2em; border-bottom: 5px solid #EA4C89; text-align: center; @@ -424,6 +424,9 @@ h1, h2, h3, h4, h5, h6 { display: none; margin-left: 0.5em; } +#table-of-contents > h2 { + margin: 0; +} #text-table-of-contents ul { padding-left: 1.8em;