Last active
November 14, 2017 19:01
-
-
Save y-ack/1e26898533975f013fea78c7d4d9df0a to your computer and use it in GitHub Desktop.
org stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#toggle-table-of-contents { | |
display: none; | |
} | |
#toggle-table-of-contents ~ label { | |
text-decoration: underline; | |
} | |
#toggle-table-of-contents ~ label::before { | |
content: "hide "; | |
} | |
#toggle-table-of-contents:checked ~ label::before { | |
content: "show "; | |
} | |
#text-table-of-contents { | |
overflow-y: hidden; | |
} | |
#toggle-table-of-contents:checked ~ #text-table-of-contents { | |
height: 0; /* could probably become a fancy transition */ | |
display: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun org-html-toc (depth info) | |
"Build a table of contents. | |
DEPTH is an integer specifying the depth of the table. INFO is a | |
plist used as a communication channel. Return the table of | |
contents as a string, or nil if it is empty." | |
(let ((toc-entries | |
(mapcar (lambda (headline) | |
(cons (org-html--format-toc-headline headline info) | |
(org-export-get-relative-level headline info))) | |
(org-export-collect-headlines info depth))) | |
(outer-tag (if (and (org-html-html5-p info) | |
(plist-get info :html-html5-fancy)) | |
"nav" | |
"div"))) | |
(when toc-entries | |
(concat (format "<%s id=\"table-of-contents\">\n" outer-tag) | |
(format "<h%d>%s</h%d>\n" | |
org-html-toplevel-hlevel | |
(org-html--translate "Table of Contents" info) | |
org-html-toplevel-hlevel) | |
;; | |
"<input id=\"toggle-table-of-contents\" type=\"checkbox\">" | |
"<label for=\"toggle-table-of-contents\">table of contents</label>" | |
;; | |
"<div id=\"text-table-of-contents\">" | |
(org-html--toc-text toc-entries) | |
"</div>\n" | |
(format "</%s>\n" outer-tag))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment