blob: 6e4db7e81ad69691bd80fe743c3ea0063f85c1a0 (
plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
;;; org-export-config.el --- Org Export Configuration -*- lexical-binding: t; -*-
;; author: Craig Jennings <c@cjennings.net>
;;; Commentary:
;;; Code:
;; --------------------------------- Org Export --------------------------------
;; backends for exporting from org-mode
(use-package ox
:defer .5
:ensure nil
:after org
:config
;; load every built-in backend
(dolist (feat '(ox-ascii
ox-beamer
ox-html
ox-icalendar
ox-latex
ox-md
ox-odt))
(require feat))
;; now tell Org exactly which backends to use
(setq org-export-backends
'(ascii
beamer
html
latex
md
odt))
;; Other Settings
(setq org-export-preserve-breaks t) ;; keep line breaks in all Org export back-ends
(setq org-export-coding-system 'utf-8) ;; force utf-8 in org
(setq org-export-headline-levels 6) ;; export headlines 6 levels deep
(setq org-export-initial-scope 'subtree) ;; export the current subtree by default
(setq org-export-with-author nil) ;; export without author by default
(setq org-export-with-section-numbers nil) ;; export without section numbers by default
(setq org-export-with-tags nil) ;; export without tags by default
(setq org-export-with-tasks '("TODO")) ;; export with tasks by default
;; (setq org-export-with-tasks nil) ;; export WITHOUT tasks by default
;; (setq org-export-with-toc nil) ;; export without table of contents by default
(setq org-export-with-toc t)) ;; export WITH table of contents by default
;; hugo markdown
(use-package ox-hugo
:after ox)
;; github flavored markdown
(use-package ox-gfm
:after ox)
;; reveal .js
(use-package ox-reveal
:after ox
:config
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js"))
;; JIRA markup
;; (use-package ox-jira
;; :after ox)
;; ;; Confluence Wiki markup
;; (use-package ox-confluence
;; :after ox)
;; ------------------------------- Org Tufte CSS -------------------------------
;; Hacks to inline a superior tufte.css style sheet into your generated html files.
;;
;; Inline tufte.css into all generated HTML documents
;; Note: the tufte.css file in my configuration has an extra style for
;; TODO and DONE task items.
;;
(defun cj/org-inline-css (path)
"Return the contents of the file at PATH as a string.
If the file doesn’t exist, return an empty string."
(if (file-readable-p path)
(with-temp-buffer
(insert-file-contents path)
(buffer-string))
(progn
(message "[org-inline-css] could not read %s" path)
"")))
(with-eval-after-load 'ox-html
;; Disable the postamble (footer) completely:
(setq org-html-postamble nil)
;; inject tufte.css from the assets folder.
(setq org-html-html5-fancy t
org-html-head-include-default-style nil
org-html-head-extra
(let* ((css-file (expand-file-name "assets/tufte.css"
user-emacs-directory))
(css (cj/org-inline-css css-file)))
(format "<style type=\"text/css\">\n%s\n</style>" css))))
;;
;; Don't allow Table of Contents to link to TODO items
;;
(defun cj/org-html-toc-remove-todo (toc-entry backend _info)
"Remove any <span class=\"todo …\">TODO</span> from a single TOC entry."
(when (eq backend 'html)
(replace-regexp-in-string
"<span class=\"todo [^\"]*\">[^<]*</span>[[:space:]]*"
"" toc-entry)))
(with-eval-after-load 'ox-html
;; register our filter so each TOC line is run through it
(add-hook 'org-export-filter-toc-entry-functions
#'cj/org-html-toc-remove-todo))
(provide 'org-export-config)
;;; org-export-config.el ends here.
|