Org html: add IDs and gutter links to non-src pre
This commit is contained in:
parent
daf304f04c
commit
23befcde9c
27
config.org
27
config.org
|
@ -738,7 +738,7 @@ inserts an org-ified version at point. Isn't that just great.
|
|||
|
||||
I have my own [[file:lisp/org-plot.el][modified version]] of ~org-plot~, so let's use that
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(package! org-plot :recipe (:local-repo "lisp" :no-byte-compile t))
|
||||
;; (package! org-plot :recipe (:local-repo "lisp" :no-byte-compile t))
|
||||
#+END_SRC
|
||||
|
||||
Org-roam is nice by itself, but there are so /extra/ nice packages which integrate
|
||||
|
@ -4786,17 +4786,30 @@ somewhat spiffy.
|
|||
(after! org
|
||||
(defun org-html-block-collapsable (orig-fn block contents info)
|
||||
"Wrap the usual block in a <details>"
|
||||
(format
|
||||
"<details class='code'%s><summary></summary>
|
||||
(let ((ref (org-export-get-reference block info))
|
||||
(type (case (car block)
|
||||
('property-drawer "Properties")))
|
||||
(collapsed-default (case (car block)
|
||||
('property-drawer t)
|
||||
(t nil)))
|
||||
(collapsed-value (org-export-read-attribute :attr_html block :collapsed)))
|
||||
(format
|
||||
"<details id='%s' class='code'%s>
|
||||
<summary%s>%s</summary>
|
||||
<div class='gutter'>\
|
||||
<a href='#%s'>#</a>
|
||||
<button title='Copy to clipboard' onclick='copyPreToClipdord(this)'>⎘</button>\
|
||||
</div>
|
||||
%s\n
|
||||
</details>"
|
||||
(if (member (org-export-read-attribute :attr_html block :collapsed)
|
||||
'("y" "yes" "t" "true"))
|
||||
"" " open")
|
||||
(funcall orig-fn block contents info)))
|
||||
ref
|
||||
(if (or (and collapsed-value (member collapsed-value '("y" "yes" "t" "true")))
|
||||
collapsed-default)
|
||||
"" " open")
|
||||
(if type " class='named'" "")
|
||||
(if type (format "<span class='type'>%s</span>" type) "")
|
||||
ref
|
||||
(funcall orig-fn block contents info))))
|
||||
|
||||
(advice-add 'org-html-example-block :around #'org-html-block-collapsable)
|
||||
(advice-add 'org-html-fixed-width :around #'org-html-block-collapsable)
|
||||
|
|
Loading…
Reference in New Issue