feat: backlinks
All checks were successful
build / build (push) Successful in 27s

This commit was merged in pull request #36.
This commit is contained in:
2026-03-28 23:34:59 -06:00
parent 9349293684
commit 55fa2473a2
4 changed files with 64 additions and 32 deletions

View File

@@ -40,7 +40,7 @@
#(do (assert (element/of-type? % "keyword"))
(:key %)))
(def ^:dynamic ^:private *document-info*)
(def ^:dynamic ^:private *opts*)
(declare ^:private gather-footnotes render-renderer-error
view-children-as-seq render-tex-snippets)
@@ -63,23 +63,28 @@
(defn org-document
"Recursively render an Org-mode document to Hiccup."
[doc]
(tex-temml/binding-worker
(let [rendered (-> doc gather-footnotes render-tex-snippets
org-element-recursive)]
[:html
[:head
[:title "org document"]
doerg-html/head]
[:body {:lang default-language}
[:article
rendered]]])))
[doc & {:as opts :keys [postamble]}]
(binding [*opts* opts]
(tex-temml/binding-worker
(let [rendered (-> doc gather-footnotes render-tex-snippets
org-element-recursive)]
[:html
[:head
[:title "org document"]
doerg-html/head]
[:body {:lang default-language}
[:article
rendered
(when postamble
[:footer
[:hr]
postamble])]]]))))
(defn to-html
"Read `f` with `slurp` as an Org document and return a string of
rendered HTML."
[f]
(str (hiccup/html {} (-> f slurp element/read-string org-document))))
rendered HTML. See `org-document` for opts."
[f & {:as opts}]
(str (hiccup/html {} (-> f slurp element/read-string (org-document opts)))))
;;; Further dispatching on `org-element`