You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide navigation anchors by generating slugs for headings and Table of
Contents links. This resolves broken links resulting from missing directives
while maintaining support for manual ID overrides.
Zine is a fast, scalable, and flexible Static Site Generator (SSG) written in Zig. It is designed for performance and provides a modern development experience with live reloading and advanced templating.
-`src/main.zig`: Entry point, dispatches CLI subcommands.
13
+
-`src/root.zig`: Core logic for configuration loading, content scanning, and site building.
14
+
-`src/worker.zig`: Handles concurrent tasks for scaling.
15
+
-`src/cli/`: Implementation of subcommands (`init`, `release`, `debug`, `serve`).
16
+
-`src/render/`: HTML rendering logic for Markdown content.
17
+
-`src/context/`: Data models for Site, Page, Assets, etc., available in templates.
18
+
19
+
## Building and Running
20
+
21
+
### Development Commands
22
+
23
+
-**Build Zine:**`zig build`
24
+
-**Check Build:**`zig build check` (faster than full build, only checks the executable)
25
+
-**Run Tests:**`zig build test` (runs snapshot tests in `tests/`)
26
+
-**Run on Test Site:**`zig build run` (runs `zine` against the `standalone-test` directory)
27
+
28
+
### CLI Usage
29
+
30
+
Once built, you can use the `zine` executable (found in `zig-out/bin/`):
31
+
32
+
-**Initialize a new site:**`zine init` (optionally with `--multilingual`)
33
+
-**Start dev server:**`zine` (default command, serves on `localhost:8000`)
34
+
-**Build for release:**`zine release` (outputs to `public/` by default)
35
+
-**Version info:**`zine version`
36
+
37
+
## Development Conventions
38
+
39
+
-**Snapshot Testing:** Zine relies heavily on snapshot tests located in `tests/`. These tests compare actual output against `snapshot.txt` files to prevent regressions.
40
+
-**Strict Typing:** Uses Zig's type system extensively to ensure correctness, particularly with `ziggy` schemas for configuration and frontmatter.
41
+
-**Performance:** Designed to be multi-threaded; `worker.zig` manages parallel processing of pages.
42
+
-**Template System:** Uses `superhtml` for layouts. Templates have access to `$site`, `$page`, and custom properties defined in frontmatter.
43
+
44
+
## Key Files
45
+
46
+
-`zine.ziggy`: The main configuration file for a Zine project.
47
+
-`frontmatter.ziggy-schema`: Defines the schema for page metadata.
48
+
-`src/root.zig`: Contains the `Site` and `Config` structs which define the project structure.
49
+
-`build.zig`: Defines the build process and test runners.
Copy file name to clipboardExpand all lines: tests/drafts/simple/snapshot/index.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,6 @@
6
6
</head>
7
7
<body>
8
8
<h1>Homepage</h1>
9
-
<div><p>Your <strong>SuperMD</strong> content goes here.</p><h1>H1</h1><p>Lorem Ipsum 1</p><h2>H2</h2><p>Lorem Ipsum 2</p><h4>H3</h4><p>Lorem Ipsum 3</p></div>
9
+
<div><p>Your <strong>SuperMD</strong> content goes here.</p><h1id="h1">H1</h1><p>Lorem Ipsum 1</p><h2id="h2">H2</h2><p>Lorem Ipsum 2</p><h4id="h3">H3</h4><p>Lorem Ipsum 3</p></div>
Copy file name to clipboardExpand all lines: tests/drafts/simple/snapshot/sections/index.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,15 @@ <h2>-- TABLE OF CONTENTS --</h2>
15
15
</div>
16
16
<div>
17
17
<h2>-- SECTION BEGIN --</h2>
18
-
<div><divid="h1"><h1><aclass="" href="#h1">H1</a></h1><p>Lorem Ipsum 1</p></div></div>
18
+
<div><divid="h1"><h1id="h1"><aclass="" href="#h1">H1</a></h1><p>Lorem Ipsum 1</p></div></div>
19
19
<h2>-- SECTION END --</h2>
20
20
21
21
<h2>-- SECTION BEGIN --</h2>
22
-
<div><divid="h2"><h2><aclass="" href="#h2">H2</a></h2><p>Lorem Ipsum 2</p></div></div>
22
+
<div><divid="h2"><h2id="h2"><aclass="" href="#h2">H2</a></h2><p>Lorem Ipsum 2</p></div></div>
23
23
<h2>-- SECTION END --</h2>
24
24
25
25
<h2>-- SECTION BEGIN --</h2>
26
-
<div><divid="h3"><h3><aclass="" href="#h3">H3</a></h3><p>Lorem Ipsum 3</p><p>This is a footnote<supclass="footnote-ref"><ahref="#fn-1" id="fn-1-ref-1">1</a></sup></p></div></div>
26
+
<div><divid="h3"><h3id="h3"><aclass="" href="#h3">H3</a></h3><p>Lorem Ipsum 3</p><p>This is a footnote<supclass="footnote-ref"><ahref="#fn-1" id="fn-1-ref-1">1</a></sup></p></div></div>
0 commit comments