Skip to content

Commit 5d47d2a

Browse files
Merge pull request #17 from ClojureCivitas/mv-notebooks-to-src
Mv notebooks to src
2 parents 0b881b1 + e1008d6 commit 5d47d2a

File tree

39 files changed

+129
-166
lines changed

39 files changed

+129
-166
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/temp
2-
/site/*/**
2+
/site/*/
33
.clj-kondo/
44
.quarto/
55
_site/

README.md

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Clojure Civitas
22

3-
<img src="notebooks/images/civitas-icon.svg" alt="Civitas Icon" align="right">
3+
<img src="src/images/civitas-icon.svg" alt="Civitas Icon" align="right">
44

5-
An open effort to structure learning resources with meaningful connections.
5+
Think. Code. Share.
66

77
⚡ No setup – Clone this repo, make a new namespace, start coding.
88

@@ -12,7 +12,7 @@ An open effort to structure learning resources with meaningful connections.
1212

1313
🧠 Build shared knowledge – Your work becomes part of a community resource.
1414

15-
🧪 Use Clay – Your normal REPL workflow, but with tables, charts, markdown, and hiccup.
15+
🧪 Visualize – Your normal REPL workflow, but with tables, charts, markdown, and hiccup.
1616

1717
## Rationale
1818

@@ -21,20 +21,24 @@ An open effort to structure learning resources with meaningful connections.
2121

2222
See [About Clojure Civitas](https://clojurecivitas.github.io/about).
2323

24+
Why markdown in code? We value reproducible artifacts.
25+
2426
## Contributing
2527

2628
Your perspective matters.
2729
Pull Requests invited, that's the point!
2830

29-
### Creating notebooks
31+
### Creating Posts and Pages
3032

31-
Add a Clojure namespace or markdown file in the [`/notebooks`](notebooks) folder.
33+
Add a Clojure namespace or markdown file in the [`/src`](src) folder.
3234

3335
Add metadata on your namespace to set the title, author, and tags.
36+
3437
```clojure
35-
^{:kindly/hide-code true ; don't show this code in the notebook
38+
^{:kindly/hide-code true ; don't render this code to the HTML document
3639
:clay {:title "About Civitas Metadata"
3740
:quarto {:author :my-unique-id
41+
:draft true ; remove to publish
3842
:type :post
3943
:date "2025-06-05"
4044
:category :clojure
@@ -45,11 +49,11 @@ Add metadata on your namespace to set the title, author, and tags.
4549
Configure your author profile in [clay.edn](clay.edn).
4650

4751
Images can be added to the same folder as the namespace,
48-
and displayed in the notebook with markdown like `![caption](my-image.jpg)`.
52+
and displayed with markdown like `;; ![caption](my-image.jpg)`.
4953
The first image on the page is used as a preview in the blog listing,
5054
unless a different image is listed in the metadata.
5155

52-
[Kindly](https://scicloj.github.io/kindly-noted/kindly) annotations in your notebook are rendered as visualizations.
56+
[Kindly](https://scicloj.github.io/kindly-noted/kindly) annotations are rendered as visualizations.
5357

5458
```clojure
5559
^kind/table
@@ -59,9 +63,14 @@ unless a different image is listed in the metadata.
5963
:many-others ["see the examples" "creative uses" "visual variety"]}
6064
```
6165

62-
**Optional:** [Setup your editor with Clay shortcuts](https://scicloj.github.io/clay/#setup) to visualize the notebook as you write.
66+
## Preview the Website **(Optional)**
67+
68+
[Use Clay REPL commands](https://scicloj.github.io/clay/#setup) to visualize the namespace as you write.
6369

64-
**Optional:** Preview the final website.
70+
Building is delegated to Clay and Quarto.
71+
72+
When using Clay interactively it renders directly to HTML for speed.
73+
The published site goes through a longer process of producing markdown then HTML.
6574

6675
```sh
6776
clojure -M:clay -a [:markdown]
@@ -75,56 +84,56 @@ quarto preview site
7584

7685
### Publish
7786

78-
Merged pull requests are automatically shown on the website.
79-
80-
To create a pull request
87+
Create a pull request:
8188

8289
1. fork the repository
83-
2. make and commit changes in a new branch
90+
2. make changes in a new branch and commit them
8491
3. push the branch to your fork
85-
4. and then open a pull request on GitHub to propose merging your changes into the Civitas main branch.
92+
4. open a pull request
8693

87-
Please contact [@timothypratley](https://github.com/timothypratley) if you are having any difficulty submitting a notebook.
94+
Your pull request will be reviewed to prevent abuse and then merged.
95+
Once merged, namespaces are automatically published to the website.
8896

89-
### See your page views
97+
Please contact [@timothypratley](https://github.com/timothypratley) if you are having any difficulty submitting a PR.
9098

91-
Publicly available [page view analytics](https://clojurecivitas.goatcounter.com/) indicate how widely your notebook is being shared.
99+
### Check Your Page Views
92100

93-
### Building the database
101+
Publicly available [page view analytics](https://clojurecivitas.goatcounter.com/) indicate how widely your idea is being shared.
94102

95-
Add to or modify [db.edn](quarto/db.edn).
103+
### Editing the Civitas Explorer Database
104+
105+
An open effort to structure learning resources with meaningful connections.
106+
Add to or modify [site/db.edn](site/db.edn).
96107
The goal is to create a database of resources for learning.
108+
See the [explorer](https://clojurecivitas.github.io/civitas/explorer.html).
97109

98110
## Design
99111

100112
Align with Clojure's values: simplicity, community, and tooling that helps you think.
101113

102-
### Notebook Namespace Selection
114+
### Namespace Selection
103115

104-
A notebook’s namespace serves as a clear, unique path to its content and follows **Clojure’s naming conventions**.
116+
A namespace serves as a clear, unique path to its content and follows **Clojure’s naming conventions**.
105117

106-
The namespace should emphasize **what the notebook is about**, not how it is categorized.
118+
The namespace should emphasize **what the narrative is about**, not how it is categorized.
107119
Think of it as a logical path that leads to a specific artifact or topic.
108120
Classification elements such as tags, author, document type, level, or publication date belong in **metadata**, not the
109121
namespace.
110122

111-
- **Start with an organization** if the notebook is about a library or tool maintained by one.
123+
- **Start with an organization** if the narrative is about a library or tool maintained by one.
112124
Examples: `scicloj`, `lambdaisland`.
113125
- **Follow with the specific library or concept.**
114-
Examples: `scicloj.clay`, `lambdaisland.kaocha`.
126+
Examples: `scicloj.clay`, `lambdaisland.kaocha`, `lambdaisland.hiccup`.
115127
- If there is **no organization**, start directly with the library or tool name.
116128
Examples: `hiccup`, `reagent`.
117-
If the notebook refers to an alternative implementation, **include the organization** to disambiguate.
118-
Example: `lambdaisland.hiccup`.
119129
- For **core Clojure topics**, use `clojure` as the root.
120130
Examples: `clojure.lazy-sequences`, `clojure.transducers`.
121-
- Add **segments** to describe the notebook’s content. These segments should:
131+
- Add **segments** to further qualify the namespace. These segments should:
122132
- Avoid name collisions.
123133
- Not duplicate metadata.
124-
- The last segment should be specific and descriptive. Prefer: `z-combinator-gambit`, avoid: `z-combinator`.
134+
- The last segment should be extra specific and descriptive. Prefer: `z-combinator-gambit`, avoid: `z-combinator`.
125135
- **Events, communities, or topics** may also be used as the top-level namespace when appropriate.
126-
Use discretion to determine whether a notebook is primarily about an artifact library,
127-
a concept, or an event.
136+
Use discretion to determine if the narrative is primarily about an artifact library, a concept, or an event.
128137
- Namespaces must consist of more than one segment.
129138

130139
#### Metadata and Navigation
@@ -160,19 +169,18 @@ Differentiation between posts, pages, and presentations is by `type` metadata (a
160169

161170
### File system organization
162171

163-
| Directory | Description |
164-
|-------------|----------------------------------------------------------------------|
165-
| `src` | Code for building a website and database |
166-
| `notebooks` | Source root for notebooks (Clojure and Markdown), images, data files |
167-
| `site` | Static assets of the Quarto website |
172+
| Directory | Description |
173+
|-----------|--------------------------------------------------------------|
174+
| `src` | Source root for namespaces, markdown, images, and data files |
175+
| `site` | Static assets of the Quarto website |
168176

169-
Non-Clojure files in `notebooks` will be synced to `site`.
170-
Shared images can go in `images`, but prefer placing images and data files as siblings to your namespace under
171-
`notebooks`.
172-
All Clojure and Non-Clojure files in `notebooks` should go under a subdirectory,
177+
Non-Clojure files in `src` will be synced to `site`.
178+
Shared images can go in `src/images`,
179+
but prefer placing images and data files as siblings to your namespace under `src`.
180+
All files in `src` should go under a subdirectory,
173181
so that it is clear they are not part of the static configuration of `site`.
174-
When building the site, Clojure namespaces are built to markdown files under `site/{my/namespaced/notebook.qmd}`.
175-
Subdirectories of `site` are gitignored and considered temporary build artifacts, safe to clean up.
182+
Clojure namespaces are built to markdown files under `site/{my/namespaced/awesome-idea.qmd}`.
183+
Subdirectories of `site` are git ignored and considered temporary build artifacts, safe to clean up.
176184
Quarto builds all the markdown into HTML in `_site` for preview and deploy.
177185
While developing, Clay uses `temp` to build and serve HTML files.
178186

@@ -192,7 +200,7 @@ Goal: Constellations, not cabinets.
192200

193201
### Dependency management
194202

195-
A single `deps.edn` file is shared across all notebooks.
203+
A single `deps.edn` file is shared.
196204

197205
Pros:
198206

@@ -203,7 +211,7 @@ Cons:
203211

204212
* Version conflicts must be manually resolved.
205213
* Only one version per dependency.
206-
* Notebooks aren’t self-contained.
214+
* Pages and posts aren’t self-contained.
207215

208216
Future:
209217

build.clj

Lines changed: 0 additions & 39 deletions
This file was deleted.

clay.edn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{:base-target-path "temp"
2-
:base-source-path "notebooks"
3-
:subdirs-to-sync ["notebooks"]
2+
:base-source-path "src"
3+
:subdirs-to-sync ["src"]
44
:sync-as-subdirs false
55
:flatten-targets false
66
:remote-repo {:git-url "https://github.com/ClojureCivitas/clojurecivitas.github.io"

deps.edn

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{:paths ["src" "notebooks"]
1+
{:paths ["src"]
22

33
:deps
44
{org.clojure/clojure {:mvn/version "1.12.0"}
@@ -17,19 +17,11 @@
1717
org.eclipse.elk/org.eclipse.elk.alg.layered {:mvn/version "0.10.0"}}
1818

1919
:aliases
20-
;; Build the site with `clojure -M:m`
21-
{:m {:main-opts ["-m" "civitas.main"]}
22-
;; Run Clay in watch mode with `clojure -J-Dclojure.main.report=stderr -M:clay`
23-
:clay {:main-opts ["-m" "scicloj.clay.v2.main"]}
20+
{;; Build the site with `clojure -M:clay -a [:markdown]`
21+
;; Run Clay in watch mode with `clojure -M:clay`
22+
:clay {:main-opts ["-m" "scicloj.clay.v2.main"]
23+
:jvm-opts ["-Dclojure.main.report=stderr"]}
2424
;; When debugging libraries
25-
:local {:override-deps {org.scicloj/clay {:local/root "../clay"}}}
26-
;; $ clojure -T:build test
27-
;; $ clojure -T:build ci
28-
:build {:deps {io.github.clojure/tools.build
29-
{:git/tag "v0.10.8" :git/sha "2fdfd66b"}}
30-
:ns-default build}
31-
:test {:extra-paths ["test"]
32-
:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
33-
io.github.cognitect-labs/test-runner
34-
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
25+
:local {:override-deps {org.scicloj/clay {:local/root "../clay"}
26+
org.scicloj/kindly-advice {:local/root "../kindly-advice"}}}
3527
:neil {:project {:name io.github.timothypratley/clojurecivitas}}}}

site/about.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ See the [Clojure Civitas Analytics Dashboard](https://clojurecivitas.goatcounter
8484

8585
Made with [Clay](https://scicloj.github.io/clay/).
8686
See the [README.md](https://github.com/ClojureCivitas/clojurecivitas.github.io/blob/main/README.md) in the repository for contribution guidelines and technical details.
87+
88+
## Why markdown in code?
89+
90+
We value reproducible artifacts.
91+
Start with code. Make it work. Then tell the story.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
:format {:html {:page-layout :full}}}}}
66
(ns civitas.explorer
77
(:require [scicloj.kindly.v4.kind :as kind]
8-
[civitas.db :as db]
9-
[civitas.geometry :as geom]
10-
[civitas.svg :as svg]))
8+
[civitas.explorer.db :as db]
9+
[civitas.explorer.geometry :as geom]
10+
[civitas.explorer.svg :as svg]))
1111

1212
;; We need a database of Clojure learning resources.
1313

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(ns civitas.db
1+
^{:clay {:quarto {:draft true}}}
2+
(ns civitas.explorer.db
23
(:require [clojure.edn :as edn]
34
[clojure.pprint :as pprint]
45
[clojure.walk :as walk]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(ns civitas.geometry
1+
^{:clay {:quarto {:draft true}}}
2+
(ns civitas.explorer.geometry
23
(:require [clojure.math :as math]))
34

45
;; Height of isosceles triangle with edge length 2
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(ns civitas.json-ld
1+
^{:clay {:quarto {:draft true}}}
2+
(ns civitas.explorer.json-ld
23
(:require [clojure.data.json :as json]))
34

45
(def ^:dynamic *ldns* "civitas")

0 commit comments

Comments
 (0)