@zvndev/darkmown 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +21 -0
- package/README.md +31 -7
- package/SECURITY.md +4 -4
- package/docs/spec-alignment.md +19 -6
- package/package.json +5 -2
- package/site/_/footer.wd +1 -1
- package/site/_/nav.wd +1 -0
- package/site/pages/app.wd +1 -1
- package/site/pages/blog/zero-js-by-default.md +1 -1
- package/site/pages/docs/index.wd +18 -2
- package/site/pages/index.js +19 -0
- package/site/pages/index.skin +46 -1
- package/site/pages/index.wd +7 -3
- package/site/pages/playground/index.js +158 -0
- package/site/pages/playground/index.skin +128 -0
- package/site/pages/playground/index.wd +51 -0
- package/site/pages/showcase/index.wd +1 -1
- package/src/builder.js +10 -8
- package/src/compiler/collections.js +16 -11
- package/src/compiler/context.js +22 -4
- package/src/compiler/expr-ast.js +296 -0
- package/src/compiler/fs-reader.js +25 -0
- package/src/compiler/includes.js +25 -14
- package/src/compiler/index.js +1 -1
- package/src/compiler/loops.js +44 -7
- package/src/compiler/page.js +97 -17
- package/src/compiler/predicates.js +4 -12
- package/src/compiler/reader.js +60 -0
- package/src/compiler/state.js +16 -18
- package/src/compiler/structure.js +40 -10
- package/src/compiler.js +57 -6
- package/src/headers.js +15 -13
- package/src/index.js +1 -0
- package/src/runtime.js +77 -45
- package/src/statics.js +6 -7
- package/src/templates/blog/site/_/nav.wd +6 -9
- package/src/templates/blog/site/pages/index.skin +7 -4
- package/src/templates/blog/site/pages/index.wd +2 -3
- package/src/templates/dashboard/site/_/nav.wd +6 -9
- package/src/templates/dashboard/site/pages/index.skin +7 -4
- package/src/templates/dashboard/site/pages/index.wd +2 -3
- package/src/templates/landing/site/_/nav.wd +6 -9
- package/src/templates/landing/site/pages/index.skin +13 -4
- package/src/templates/landing/site/pages/index.wd +22 -9
- package/src/templates/starter/site/_/nav.wd +7 -10
- package/src/templates/starter/site/pages/about.md +7 -18
- package/src/templates/starter/site/pages/about.skin +0 -25
- package/src/templates/starter/site/pages/index.skin +10 -6
- package/src/templates/starter/site/pages/index.wd +2 -3
- package/src/templates/store/site/_/nav.wd +6 -9
- package/src/templates/store/site/pages/index.skin +7 -4
- package/src/templates/store/site/pages/index.wd +2 -3
- package/types/compiler.d.ts +13 -0
- package/types/index.d.ts +1 -0
|
@@ -27,12 +27,12 @@ page
|
|
|
27
27
|
line-height 1.6
|
|
28
28
|
-webkit-font-smoothing antialiased
|
|
29
29
|
|
|
30
|
-
main
|
|
30
|
+
.main
|
|
31
31
|
max-width 900px
|
|
32
32
|
margin 0 auto
|
|
33
33
|
padding 1rem 1.5rem 4rem
|
|
34
34
|
|
|
35
|
-
nav
|
|
35
|
+
.nav
|
|
36
36
|
display flex
|
|
37
37
|
align-items center
|
|
38
38
|
justify-content space-between
|
|
@@ -40,10 +40,13 @@ nav
|
|
|
40
40
|
margin 0 auto
|
|
41
41
|
padding 1.25rem 1.5rem
|
|
42
42
|
|
|
43
|
-
nav
|
|
43
|
+
.nav p
|
|
44
|
+
margin 0
|
|
45
|
+
|
|
46
|
+
.nav strong
|
|
44
47
|
font-size 1.15rem
|
|
45
48
|
|
|
46
|
-
nav a
|
|
49
|
+
.nav a
|
|
47
50
|
color $accent
|
|
48
51
|
text-decoration none
|
|
49
52
|
|
|
@@ -60,6 +63,9 @@ nav a
|
|
|
60
63
|
color $muted
|
|
61
64
|
margin 0 0 1.5rem
|
|
62
65
|
|
|
66
|
+
.lede p
|
|
67
|
+
margin 0
|
|
68
|
+
|
|
63
69
|
.cta
|
|
64
70
|
display inline-flex
|
|
65
71
|
align-items center
|
|
@@ -186,6 +192,9 @@ input:focus-visible, textarea:focus-visible, select:focus-visible
|
|
|
186
192
|
color $muted
|
|
187
193
|
font-size .95rem
|
|
188
194
|
|
|
195
|
+
.quote .who p
|
|
196
|
+
margin 0
|
|
197
|
+
|
|
189
198
|
.wd-carousel-prev
|
|
190
199
|
position absolute
|
|
191
200
|
left -.5rem
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
html: true
|
|
3
2
|
title: Acme — ship faster
|
|
4
3
|
description: A marketing one-pager built with Darkmown. Zero framework JS on the static parts, with a testimonials carousel.
|
|
5
4
|
transitions: true
|
|
@@ -7,12 +6,16 @@ transitions: true
|
|
|
7
6
|
|
|
8
7
|
@include /nav.wd
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
::: main
|
|
11
10
|
|
|
12
11
|
::: hero
|
|
13
12
|
# Ship faster with *Acme*
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
::: lede
|
|
15
|
+
The all-in-one toolkit your team actually enjoys using.
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
[Get started](#start){.cta}
|
|
16
19
|
:::
|
|
17
20
|
|
|
18
21
|
::: features
|
|
@@ -35,21 +38,31 @@ One command to Vercel or Cloudflare — your API comes along for free.
|
|
|
35
38
|
:carousel
|
|
36
39
|
::: quote
|
|
37
40
|
> "Acme cut our launch time in half."
|
|
38
|
-
|
|
41
|
+
|
|
42
|
+
::: who
|
|
43
|
+
— Riley, Head of Product
|
|
44
|
+
:::
|
|
39
45
|
:::
|
|
40
46
|
::: quote
|
|
41
47
|
> "The simplest stack we've ever shipped on."
|
|
42
|
-
|
|
48
|
+
|
|
49
|
+
::: who
|
|
50
|
+
— Sam, CTO
|
|
51
|
+
:::
|
|
43
52
|
:::
|
|
44
53
|
::: quote
|
|
45
54
|
> "Our marketing pages load instantly now."
|
|
46
|
-
|
|
55
|
+
|
|
56
|
+
::: who
|
|
57
|
+
— Jordan, Growth
|
|
58
|
+
:::
|
|
47
59
|
:::
|
|
48
60
|
:endcarousel
|
|
49
61
|
|
|
50
62
|
::: cta-band #start
|
|
51
63
|
## Ready to build?
|
|
52
|
-
|
|
64
|
+
|
|
65
|
+
[Start now](/){.cta}
|
|
53
66
|
:::
|
|
54
67
|
|
|
55
|
-
|
|
68
|
+
:::
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: About
|
|
3
|
-
html: true
|
|
4
3
|
---
|
|
5
4
|
|
|
6
|
-
<nav>
|
|
7
|
-
<strong>My site</strong>
|
|
8
|
-
<span class="links">
|
|
9
|
-
<a href="/">Home</a>
|
|
10
|
-
<a href="/about/">About</a>
|
|
11
|
-
</span>
|
|
12
|
-
</nav>
|
|
13
|
-
|
|
14
|
-
<main>
|
|
15
|
-
|
|
16
5
|
# About
|
|
17
6
|
|
|
18
|
-
This page is plain Markdown (`.md`) — strict CommonMark, zero framework
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
This page is plain Markdown (`.md`) — strict CommonMark, zero framework
|
|
8
|
+
JavaScript, and no raw HTML (Darkmown escapes it by default, so untrusted
|
|
9
|
+
content can't inject markup). That's why there's no shared nav bar here: a
|
|
10
|
+
`.md` page can't `@include` or use directives.
|
|
21
11
|
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
Rename it to `.wd` when you want that — state, loops, forms, and an
|
|
13
|
+
`@include /nav.wd` for the shared nav. The colocated `about.skin` styles this
|
|
14
|
+
page either way; it attaches automatically by basename, `.md` or `.wd` alike.
|
|
24
15
|
|
|
25
16
|
[Back home](/)
|
|
26
|
-
|
|
27
|
-
</main>
|
|
@@ -32,31 +32,6 @@ main
|
|
|
32
32
|
margin 0 auto
|
|
33
33
|
padding 3rem 1.5rem
|
|
34
34
|
|
|
35
|
-
nav
|
|
36
|
-
display flex
|
|
37
|
-
align-items center
|
|
38
|
-
justify-content space-between
|
|
39
|
-
gap 1rem
|
|
40
|
-
max-width 760px
|
|
41
|
-
margin 0 auto
|
|
42
|
-
padding 1.25rem 1.5rem
|
|
43
|
-
|
|
44
|
-
nav strong
|
|
45
|
-
font-size 1.1rem
|
|
46
|
-
|
|
47
|
-
nav .links
|
|
48
|
-
display flex
|
|
49
|
-
gap 1.25rem
|
|
50
|
-
|
|
51
|
-
nav a
|
|
52
|
-
color $ink
|
|
53
|
-
text-decoration none
|
|
54
|
-
opacity .8
|
|
55
|
-
|
|
56
|
-
nav a:hover
|
|
57
|
-
opacity 1
|
|
58
|
-
color $accent
|
|
59
|
-
|
|
60
35
|
a
|
|
61
36
|
color $accent
|
|
62
37
|
|
|
@@ -27,12 +27,12 @@ page
|
|
|
27
27
|
line-height 1.6
|
|
28
28
|
-webkit-font-smoothing antialiased
|
|
29
29
|
|
|
30
|
-
main
|
|
30
|
+
.main
|
|
31
31
|
max-width 760px
|
|
32
32
|
margin 0 auto
|
|
33
33
|
padding 3rem 1.5rem
|
|
34
34
|
|
|
35
|
-
nav
|
|
35
|
+
.nav
|
|
36
36
|
display flex
|
|
37
37
|
align-items center
|
|
38
38
|
justify-content space-between
|
|
@@ -41,19 +41,23 @@ nav
|
|
|
41
41
|
margin 0 auto
|
|
42
42
|
padding 1.25rem 1.5rem
|
|
43
43
|
|
|
44
|
-
nav
|
|
44
|
+
.nav p
|
|
45
|
+
margin 0
|
|
46
|
+
|
|
47
|
+
.nav strong
|
|
45
48
|
font-size 1.1rem
|
|
46
49
|
|
|
47
|
-
nav .links
|
|
50
|
+
.nav .links p
|
|
48
51
|
display flex
|
|
49
52
|
gap 1.25rem
|
|
53
|
+
margin 0
|
|
50
54
|
|
|
51
|
-
nav a
|
|
55
|
+
.nav a
|
|
52
56
|
color $ink
|
|
53
57
|
text-decoration none
|
|
54
58
|
opacity .8
|
|
55
59
|
|
|
56
|
-
nav a:hover
|
|
60
|
+
.nav a:hover
|
|
57
61
|
opacity 1
|
|
58
62
|
color $accent
|
|
59
63
|
|
|
@@ -27,12 +27,12 @@ page
|
|
|
27
27
|
line-height 1.55
|
|
28
28
|
-webkit-font-smoothing antialiased
|
|
29
29
|
|
|
30
|
-
main
|
|
30
|
+
.main
|
|
31
31
|
max-width 860px
|
|
32
32
|
margin 0 auto
|
|
33
33
|
padding 2rem 1.5rem
|
|
34
34
|
|
|
35
|
-
nav
|
|
35
|
+
.nav
|
|
36
36
|
display flex
|
|
37
37
|
align-items center
|
|
38
38
|
justify-content space-between
|
|
@@ -40,10 +40,13 @@ nav
|
|
|
40
40
|
margin 0 auto
|
|
41
41
|
padding 1.25rem 1.5rem
|
|
42
42
|
|
|
43
|
-
nav
|
|
43
|
+
.nav p
|
|
44
|
+
margin 0
|
|
45
|
+
|
|
46
|
+
.nav strong
|
|
44
47
|
font-size 1.1rem
|
|
45
48
|
|
|
46
|
-
nav a
|
|
49
|
+
.nav a
|
|
47
50
|
color $accent
|
|
48
51
|
text-decoration none
|
|
49
52
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
html: true
|
|
3
2
|
title: Shop — built with Darkmown
|
|
4
3
|
description: A storefront in Markdown — live search, a shared cart, and a checkout that posts to a serverless function.
|
|
5
4
|
transitions: true
|
|
@@ -7,7 +6,7 @@ transitions: true
|
|
|
7
6
|
|
|
8
7
|
@include /nav.wd
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
::: main
|
|
11
10
|
|
|
12
11
|
::: section #shop
|
|
13
12
|
|
|
@@ -81,4 +80,4 @@ to { receipt.received.email }. Order { receipt.orderId }.
|
|
|
81
80
|
|
|
82
81
|
:::
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
:::
|
package/types/compiler.d.ts
CHANGED
|
@@ -14,6 +14,19 @@ export function compilePage(file: string, context: Paths): CompiledPage;
|
|
|
14
14
|
* @returns {CompiledDocument}
|
|
15
15
|
*/
|
|
16
16
|
export function compileDocument(file: string, context: Paths, stack?: string[], vars?: Record<string, unknown>): CompiledDocument;
|
|
17
|
+
/**
|
|
18
|
+
* Compile a page from an in-memory map of project-relative path → source, with
|
|
19
|
+
* no filesystem access. `entryPath` is the project-relative path of the page to
|
|
20
|
+
* compile; includes and `@loop` data resolve against the same map.
|
|
21
|
+
* @param {Record<string, string> | Map<string, string>} files
|
|
22
|
+
* @param {string} entryPath
|
|
23
|
+
* @param {{ vars?: Record<string, unknown>, cwd?: string }} [options]
|
|
24
|
+
* @returns {CompiledPage}
|
|
25
|
+
*/
|
|
26
|
+
export function compileFromMemory(files: Record<string, string> | Map<string, string>, entryPath: string, options?: {
|
|
27
|
+
vars?: Record<string, unknown>;
|
|
28
|
+
cwd?: string;
|
|
29
|
+
}): CompiledPage;
|
|
17
30
|
/**
|
|
18
31
|
* Split a raw file into its frontmatter `meta` and `body`.
|
|
19
32
|
* @param {string} raw Full file contents.
|