org HTML export with embedded images

This commit is contained in:
2020-10-23 07:31:21 +02:00
parent 3e1df5a8c2
commit b5ff6abb30
2 changed files with 23 additions and 2 deletions

View File

@@ -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 "<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))
))
#+end_src
** Org Mode Bling
#+BEGIN_SRC emacs-lisp
(use-package org-bullets
:init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))

View File

@@ -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;