Browse Source

Update read me

master
Dylan Baker 5 years ago
parent
commit
907ea6cff4
1 changed files with 79 additions and 3 deletions
  1. 79
    3
      README.md

+ 79
- 3
README.md View File

@@ -1,14 +1,90 @@
1 1
 # Casaubon
2 2
 
3
-Casaubon is a static site generator written in Rust. I had very specific goals in mind when writing Casaubon and it is not meant to be all things for all people. Casaubon does what it is intended to do and no more.
3
+Casaubon is a static site generator written in Rust. I had very specific goals
4
+in mind when writing Casaubon and it is not meant to be all things for all
5
+people. Casaubon does what it is intended to do and no more.
4 6
 
5
-Goals
7
+### Goals
6 8
 
7 9
 - Convention over configuration
8 10
 - Learn Rust
9 11
 - Fast compile times
10 12
 
11
-Non-goals
13
+### Non-goals
12 14
 
13 15
 - Extensibility
14 16
 - Flexibility
17
+
18
+## Installation
19
+
20
+(requires [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html))
21
+
22
+```
23
+$ cargo install --git https://sr.ht/~simulacrumparty/casaubon
24
+```
25
+
26
+## Run tests
27
+
28
+```
29
+$ ./test
30
+```
31
+
32
+## Usage
33
+
34
+
35
+Create a new project
36
+
37
+```
38
+$ casaubon new
39
+```
40
+
41
+Generate HTML files
42
+
43
+```
44
+$ casaubon build
45
+```
46
+
47
+Watch files for changes and rebuild. Note that there is no dev server built in.
48
+
49
+```
50
+$ casaubon watch
51
+```
52
+
53
+`build` and `watch` both accept a `--drafts` flag if you wish to include drafts
54
+in the generated HTML files.
55
+
56
+## Configuration
57
+
58
+Casuabon is not intended to be as flexible as most static site generators.
59
+Currently, the only configuration option is the name of the site, which can be
60
+set in `casaubon.toml`.
61
+
62
+## Writing
63
+
64
+Casuabon expects the first line of post files to consist of a `#` followed by a
65
+space and the name of the post, followed by two newlines. For example:
66
+
67
+_posts/first-post.md_
68
+
69
+```
70
+# First Post
71
+
72
+Lorem ipsum dolor sit amet....
73
+```
74
+
75
+In this example, the post's title would get parsed as "First Post", and the
76
+post's body would get parsed as "Lorem ipsum dolor sit amet...". The slug gets
77
+parsed from the filename, and in this case would be 'first-post'.
78
+
79
+## Templates
80
+
81
+Casaubon creates a number of templates for you in the `templates` directory.
82
+These include:
83
+
84
+|Title                   |Description|
85
+|------------------------|-----------|
86
+|`layout.html`           |The main layout. All page content gets injected into the `{{ contents }}` variable. The title of the page is available in the `{{ page_title }}` variable.|
87
+|`post.html`             |The template for rendering a single post. Variables available include `{{ title }}` and `{{ body }}`.|
88
+|`page.html`             |The template for rendering a single page. Variables available include `{{ title }}` and `{{ body }}`.|
89
+|`post_listing.html`     |This template is for the list of posts on the index page. The `{{ post_listing }}` variable contains the result of compiling the `post_listing_item.html` template against each post.|
90
+|`post_listing_item.html`|This template determines how each post will appear in the main listing. Variables available include `{{ title }}` and `{{ slug }}`.|

Loading…
Cancel
Save