Files And Headlines

Last updated:
2020-10-14 18:13

Purpose: This document explains how to render org-mode files in their entirety or select portions of a file. It also covers folding of headlines and their respective content.

Prerequistes: an understanding of The Render Function and how layouts work.

Usage

To render an entire org-mode file:

Render an entire file

(defn default
  [{:keys [render partials]}]
  (let [{:keys [head]} partials]
    (head)
    [:body
     [:div (render :file)]]))

Rendering specific headlines and content

(defn default
  [{:keys [render partials]}]
  (let [{:keys [head]} partials]
    (head)
    [:body
      [:div (render "Notes")] ; render everything in "Notes" (including the heading "Notes")
      [:div (render "Notes" {:exclude-headline? true})] ; render the content in "Notes", excluding the heading.
      ]))

Exclude a headline

Similar to org-export, you can add the :noexport: tag to a headline. Doing so will exclude the headline and all it's children from being rendered.

Next: Folding