cmc/org-templates

Org-mode templates.

clone: git clone https://gitbay.org/cmc/org-templates.git

2dbea8e72f3c6c31e0426b59b943df44052dcc9f

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2025-06-04T17:19:43Z

feat: add build process
 .gitignore                         |  1 +
 README.org                         |  8 ++++
 assets/styles.css                  | 75 ++++++++++++++++++++++++++++++++++++++
 export.sh                          | 36 ++++++++++++++++++
 templates/generic/zettelkasten.org | 10 -----
 5 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b7f1399
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.build
\ No newline at end of file
diff --git a/README.org b/README.org
index a7c3348..d215a9d 100644
--- a/README.org
+++ b/README.org
@@ -6,6 +6,14 @@ This repository contains reusable Org-mode templates intended for structured
 documentation of various workflows. Templates are grouped by domain under the
 =templates/= directory.
 
+See the live preview of these templates exported to HTML at
+[[https://org-templates.cleberg.net][org-templates.cleberg.net]]. A set of
+minimal CSS rules are applied from the =assets/styles.css= file.
+
+To generate the HTML files locally, run the provided =export.sh= script from a
+command line shell. This script processes the Org files and produces the HTML
+exports. No additional configuration is required.
+
 * Directory Structure
 
 The repository is organized as follows:
diff --git a/assets/styles.css b/assets/styles.css
new file mode 100644
index 0000000..23def5f
--- /dev/null
+++ b/assets/styles.css
@@ -0,0 +1,75 @@
+/* styles.css */
+/* Minimal, readable styles for Org-mode HTML exports */
+
+body {
+  font-family: system-ui, sans-serif;
+  font-size: 16px;
+  line-height: 1.6;
+  color: #222;
+  background: #ffffff;
+  margin: 2rem auto;
+  max-width: 800px;
+  padding: 0 1rem;
+}
+
+h1, h2, h3, h4 {
+  font-weight: 600;
+  margin-top: 2rem;
+  margin-bottom: 1rem;
+}
+
+h1 { font-size: 1.75rem; border-bottom: 2px solid #ccc; padding-bottom: 0.3rem; }
+h2 { font-size: 1.5rem; border-bottom: 1px solid #ddd; padding-bottom: 0.2rem; }
+h3 { font-size: 1.25rem; }
+h4 { font-size: 1.1rem; }
+
+ul, ol {
+  margin-left: 1.5rem;
+  padding-left: 0;
+}
+
+pre, code {
+  font-family: monospace;
+  background: #f4f4f4;
+  padding: 0.2em 0.4em;
+  border-radius: 4px;
+}
+
+pre {
+  padding: 1em;
+  overflow-x: auto;
+}
+
+blockquote {
+  margin-left: 1rem;
+  padding-left: 1rem;
+  border-left: 3px solid #ccc;
+  color: #555;
+}
+
+table {
+  border-collapse: collapse;
+  width: 100%;
+  margin: 1rem 0;
+}
+
+th, td {
+  border: 1px solid #ccc;
+  padding: 0.5rem;
+  text-align: left;
+}
+
+hr {
+  border: none;
+  border-top: 1px solid #ccc;
+  margin: 2rem 0;
+}
+
+a {
+  color: #0366d6;
+  text-decoration: none;
+}
+
+a:hover {
+  text-decoration: underline;
+}
\ No newline at end of file
diff --git a/export.sh b/export.sh
new file mode 100755
index 0000000..f5756a8
--- /dev/null
+++ b/export.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+set -e
+
+SRC_ROOT="${1:-$(pwd)/templates}"
+DEST_ROOT="$(pwd)/.build"
+CSS_SRC="$(pwd)/assets/styles.css"
+CSS_DEST="$DEST_ROOT/assets/styles.css"
+
+# Clean and recreate build directory
+rm -rf "$DEST_ROOT"
+mkdir -p "$DEST_ROOT/assets"
+cp "$CSS_SRC" "$CSS_DEST"
+
+# Export and relocate
+find "$SRC_ROOT" -name "*.org" | while read -r org_file; do
+    # Relative path from templates root
+    rel_path="${org_file#$SRC_ROOT/}"
+    rel_dir=$(dirname "$rel_path")
+    base_name=$(basename "$org_file" .org)
+
+    # Temporary output will go next to source
+    echo "Exporting: $rel_path"
+
+    emacs "$org_file" \
+        --batch \
+        --eval '(require '\''ox-html)' \
+        --eval "(setq org-html-head \"<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"../assets/styles.css\\\" />\")" \
+        --eval '(org-html-export-to-html)'
+
+    # Move output file to .build
+    mkdir -p "$DEST_ROOT/$rel_dir"
+    mv "$(dirname "$org_file")/${base_name}.html" "$DEST_ROOT/$rel_dir/"
+done
+
+echo "Export complete. Output is in .build/"
\ No newline at end of file
diff --git a/templates/generic/zettelkasten.org b/templates/generic/zettelkasten.org
deleted file mode 100644
index 9caa61f..0000000
--- a/templates/generic/zettelkasten.org
+++ /dev/null
@@ -1,10 +0,0 @@
-* [[id:202506040934][Note Title]]
-:PROPERTIES:
-:ID:       202506040934
-:DATE:     %U
-:END:
-
-** Summary
-** Key Points
-** Links
-- [[id:202506041000][Related Note]]