-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.el
94 lines (75 loc) · 2.63 KB
/
export.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
(require 'package)
(package-initialize)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")))
(package-refresh-contents)
(package-install 'htmlize)
(package-install 'rainbow-delimiters)
(package-install 'yaml-mode)
(package-install 'clojure-mode)
(package-install 'go-mode)
(package-install 'toml-mode)
(package-install 'dockerfile-mode)
(package-install 'highlight-numbers)
(package-install 'highlight-quoted)
(package-install 'typescript-mode)
(require 'org)
(require 'htmlize)
(require 'css-mode)
(require 'diff-mode)
(require 'rainbow-delimiters)
(require 'yaml-mode)
(require 'clojure-mode)
(require 'go-mode)
(require 'toml-mode)
(require 'dockerfile-mode)
(require 'highlight-numbers)
(require 'highlight-quoted)
(require 'typescript-mode)
(defun zezin-load-theme ()
(package-install 'doom-themes)
(require 'doom-themes)
(load-theme 'doom-one 'no-confirm))
(defun zezin-fix-htmlize-quirks ()
;; Fix "Invalid face: tab-line-tab hl-line"
(require 'tab-line)
(require 'hl-line)
;; Looks like a bug where default face inherit is nil
(set-face-attribute 'default nil :inherit 'unspecified))
(defun zezin-generate-themefile ()
(zezin-load-theme)
(zezin-fix-htmlize-quirks)
(org-html-htmlize-generate-css))
(defun zezin-generate-ones ()
(zezin-fix-htmlize-quirks)
(with-temp-buffer
(let ((fl (face-list))
(htmlize-css-name-prefix "org-")
(htmlize-output-type 'css)
f i)
(while (setq f (pop fl)
i (and f (face-attribute f :inherit)))
(when (and (symbolp f) (or (not i) (not (listp i))))
(insert (org-add-props (copy-sequence "1") nil 'face f))))
(htmlize-region (point-min) (point-max)))))
(with-eval-after-load 'highlight-quoted
(add-hook 'emacs-lisp-mode-hook #'highlight-quoted-mode))
(with-eval-after-load 'rainbow-delimiters
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
(with-eval-after-load 'highlight-numbers
(add-hook 'prog-mode-hook #'highlight-numbers-mode))
(zezin-load-theme)
(with-eval-after-load 'org
(setq org-export-with-sub-superscripts nil)
(setq org-html-htmlize-output-type 'css)
(setq org-html-html5-fancy t
org-html-doctype "html5")
(load-file "posts-config.el")
(zezin-set-posts-info "org" "content/posts" "static")
;; Rewrites ./res/img.png to /res/img.png
(defun zezin-rewrite-link (orig-fun &rest args )
"Replaces org-html-link images with absolue URLs"
(let ((res (apply orig-fun args)))
(if (and (stringp res) (string-match-p "<img src=" res))
(replace-regexp-in-string "./res" "/res" res)
res)))
(advice-add #'org-html-link :around #'zezin-rewrite-link))