@lvl99dotcom/edaha.md 0.0.0-stage → 0.2.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.
Files changed (52) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +13 -2
  3. package/dist/cli/bin.d.ts +2 -0
  4. package/dist/cli/bin.js +9 -0
  5. package/dist/cli/index.d.ts +71 -0
  6. package/dist/cli/index.js +149 -0
  7. package/dist/embeds/blocks/index.d.ts +59 -0
  8. package/dist/embeds/blocks/index.js +103 -0
  9. package/dist/embeds/index.d.ts +143 -0
  10. package/dist/embeds/index.js +411 -0
  11. package/dist/embeds/types/index.d.ts +117 -0
  12. package/dist/embeds/types/index.js +1 -0
  13. package/dist/generator/article/index.d.ts +151 -0
  14. package/dist/generator/article/index.js +325 -0
  15. package/dist/generator/build/index.d.ts +109 -0
  16. package/dist/generator/build/index.js +363 -0
  17. package/dist/generator/config/index.d.ts +96 -0
  18. package/dist/generator/config/index.js +298 -0
  19. package/dist/generator/configFile/index.d.ts +58 -0
  20. package/dist/generator/configFile/index.js +122 -0
  21. package/dist/generator/fields/index.d.ts +93 -0
  22. package/dist/generator/fields/index.js +186 -0
  23. package/dist/generator/format/index.d.ts +92 -0
  24. package/dist/generator/format/index.js +177 -0
  25. package/dist/generator/lists/index.d.ts +63 -0
  26. package/dist/generator/lists/index.js +133 -0
  27. package/dist/generator/markdown/index.d.ts +25 -0
  28. package/dist/generator/markdown/index.js +62 -0
  29. package/dist/generator/metadata/index.d.ts +150 -0
  30. package/dist/generator/metadata/index.js +361 -0
  31. package/dist/generator/metadataGroups/index.d.ts +45 -0
  32. package/dist/generator/metadataGroups/index.js +169 -0
  33. package/dist/generator/slug/index.d.ts +26 -0
  34. package/dist/generator/slug/index.js +57 -0
  35. package/dist/generator/templates/index.d.ts +88 -0
  36. package/dist/generator/templates/index.js +175 -0
  37. package/dist/generator/types/index.d.ts +186 -0
  38. package/dist/generator/types/index.js +1 -0
  39. package/dist/generator/urls/index.d.ts +50 -0
  40. package/dist/generator/urls/index.js +77 -0
  41. package/dist/index.d.ts +8 -0
  42. package/dist/index.js +9 -0
  43. package/dist/theme/index.d.ts +8 -0
  44. package/dist/theme/index.js +9 -0
  45. package/package.json +64 -3
  46. package/theme/static/base.css +328 -0
  47. package/theme/templates/article/list.njk +69 -0
  48. package/theme/templates/article/single.njk +64 -0
  49. package/theme/templates/layouts/html.njk +72 -0
  50. package/theme/templates/layouts/rssfeed.njk +28 -0
  51. package/theme/templates/page/home.njk +16 -0
  52. package/theme/templates/page/single.njk +18 -0
@@ -0,0 +1,328 @@
1
+ /* edaha.md's default theme: system fonts, readable widths, light and dark colours. Replace it with your own static/site.css */
2
+ :root {
3
+ color-scheme: light dark;
4
+ --colour-text: #1d1d1f;
5
+ --colour-muted: #5a5a60;
6
+ --colour-background: #ffffff;
7
+ --colour-surface: #f4f4f6;
8
+ --colour-border: #d8d8de;
9
+ --colour-link: #bc4501;
10
+ --colour-link-hover: #db5a10;
11
+ --colour-focus: #db5a10;
12
+ --font-size-base: 16px;
13
+ --font-size-title: 48px;
14
+ --font-size-h1: 32px;
15
+ --font-size-h2: 28px;
16
+ --font-size-h3: 24px;
17
+ --font-size-h4: 20px;
18
+ --font-size-h5: 18px;
19
+ --font-size-h6: 16px;
20
+ }
21
+
22
+ /* Dark colours: the device's choice unless the theme switcher chose light, or the theme switcher's choice */
23
+ @media (prefers-color-scheme: dark) {
24
+ :root:not([data-theme="light"]) {
25
+ --colour-text: #ececf0;
26
+ --colour-muted: #a6a6ae;
27
+ --colour-background: #141416;
28
+ --colour-surface: #1f1f23;
29
+ --colour-border: #38383f;
30
+ --colour-link: #dc6d2c;
31
+ --colour-link-hover: #fda26d;
32
+ --colour-focus: #fda26d;
33
+ }
34
+ }
35
+
36
+ :root[data-theme="dark"] {
37
+ color-scheme: dark;
38
+ --colour-text: #ececf0;
39
+ --colour-muted: #a6a6ae;
40
+ --colour-background: #141416;
41
+ --colour-surface: #1f1f23;
42
+ --colour-border: #38383f;
43
+ --colour-link: #dc6d2c;
44
+ --colour-link-hover: #fda26d;
45
+ --colour-focus: #fda26d;
46
+ }
47
+
48
+ :root[data-theme="light"] {
49
+ color-scheme: light;
50
+ }
51
+
52
+ *,
53
+ *::before,
54
+ *::after {
55
+ box-sizing: border-box;
56
+ }
57
+
58
+ body {
59
+ margin: 0;
60
+ background: var(--colour-background);
61
+ color: var(--colour-text);
62
+ font-family: Arial, sans-serif;
63
+ font-size: 1.0625rem;
64
+ line-height: 1.6;
65
+ }
66
+
67
+ a {
68
+ color: var(--colour-link);
69
+ }
70
+
71
+ a:hover {
72
+ color: var(--colour-link-hover);
73
+ }
74
+
75
+ a:focus-visible,
76
+ button:focus-visible,
77
+ .button:focus-visible {
78
+ outline: 3px solid var(--colour-focus);
79
+ outline-offset: 2px;
80
+ }
81
+
82
+ h1 {
83
+ font-size: var(--font-size-h1);
84
+ }
85
+
86
+ h2 {
87
+ font-size: var(--font-size-h2);
88
+ }
89
+
90
+ h3 {
91
+ font-size: var(--font-size-h3);
92
+ }
93
+
94
+ h4 {
95
+ font-size: var(--font-size-h4);
96
+ }
97
+
98
+ h5 {
99
+ font-size: var(--font-size-h5);
100
+ }
101
+
102
+ h6 {
103
+ font-size: var(--font-size-h6);
104
+ }
105
+
106
+ img {
107
+ max-width: 100%;
108
+ height: auto;
109
+ }
110
+
111
+ pre {
112
+ overflow-x: auto;
113
+ padding: 1rem;
114
+ background: var(--colour-surface);
115
+ }
116
+
117
+ code {
118
+ background: var(--colour-surface);
119
+ color: var(--colour-muted);
120
+ font-size: 0.9em;
121
+ padding: 0.2em;
122
+ }
123
+
124
+ /* Hidden on screen but read by screen readers, e.g. extra context for "Read more" links */
125
+ .visually-hidden {
126
+ position: absolute;
127
+ width: 1px;
128
+ height: 1px;
129
+ margin: -1px;
130
+ padding: 0;
131
+ border: 0;
132
+ overflow: hidden;
133
+ clip: rect(0 0 0 0);
134
+ clip-path: inset(50%);
135
+ white-space: nowrap;
136
+ }
137
+
138
+ /* Raw content is shown as it is written: in the page's own font, keeping its spaces and line breaks */
139
+ .raw {
140
+ font: inherit;
141
+ white-space: pre-wrap;
142
+ }
143
+
144
+ pre.raw {
145
+ padding: 0;
146
+ background: none;
147
+ }
148
+
149
+ table {
150
+ border-collapse: collapse;
151
+ }
152
+
153
+ th,
154
+ td {
155
+ padding: 0.25rem 0.5rem;
156
+ border: 1px solid var(--colour-border);
157
+ }
158
+
159
+ aside {
160
+ color: var(--colour-muted);
161
+ }
162
+
163
+ /* Switches between the light and dark theme (see theme-switcher.js) */
164
+ .theme-switcher {
165
+ padding: 0.25rem;
166
+ border: 0;
167
+ background: none;
168
+ color: inherit;
169
+ font: inherit;
170
+ cursor: pointer;
171
+ }
172
+
173
+ .button {
174
+ display: inline-block;
175
+ padding: 0.5rem 1rem;
176
+ border: 1px solid var(--colour-border);
177
+ border-radius: 0.375rem;
178
+ background: var(--colour-surface);
179
+ color: var(--colour-text);
180
+ text-decoration: none;
181
+ }
182
+
183
+ .button:hover {
184
+ border-color: var(--colour-link);
185
+ color: var(--colour-text);
186
+ }
187
+
188
+ .site-header,
189
+ .site-content,
190
+ .site-footer {
191
+ max-width: 64rem;
192
+ margin-inline: auto;
193
+ padding-inline: 1rem;
194
+ }
195
+
196
+ .site-header {
197
+ padding-block: 1rem;
198
+ border-bottom: 1px solid var(--colour-border);
199
+ }
200
+
201
+ .site-title {
202
+ margin: 0;
203
+ font-size: 1.5rem;
204
+ font-weight: 700;
205
+ }
206
+
207
+ .site-title a {
208
+ color: inherit;
209
+ text-decoration: none;
210
+ }
211
+
212
+ .site-content {
213
+ display: grid;
214
+ gap: 2rem;
215
+ padding-block: 1.5rem;
216
+ }
217
+
218
+ @media (min-width: 48rem) {
219
+ .site-content:has(> aside) {
220
+ grid-template-columns: 1fr 16rem;
221
+ }
222
+ }
223
+
224
+ .site-main {
225
+ min-width: 0;
226
+ }
227
+
228
+ .site-content > aside dt {
229
+ font-weight: 700;
230
+ }
231
+
232
+ .site-content > aside dd {
233
+ margin: 0 0 0.75rem;
234
+ }
235
+
236
+ .site-breadcrumb ul {
237
+ display: flex;
238
+ flex-wrap: wrap;
239
+ margin: 0;
240
+ padding: 0;
241
+ list-style: none;
242
+ color: var(--colour-muted);
243
+ font-size: 0.9375rem;
244
+ }
245
+
246
+ .site-breadcrumb li + li::before {
247
+ content: "/";
248
+ margin-inline: 0.5rem;
249
+ }
250
+
251
+ .site-breadcrumb,
252
+ .site-breadcrumb a:link,
253
+ .site-breadcrumb a:visited {
254
+ color: var(--colour-muted);
255
+ text-decoration: none;
256
+ }
257
+
258
+ .site-breadcrumb a:hover,
259
+ .site-breadcrumb a:active,
260
+ .site-breadcrumb a[aria-current] {
261
+ color: var(--colour-link-hover);
262
+ text-decoration: none;
263
+ }
264
+
265
+ .article-meta,
266
+ .article-updated {
267
+ color: var(--colour-muted);
268
+ font-size: 0.9375rem;
269
+ }
270
+
271
+ .list-articles {
272
+ margin: 0;
273
+ padding: 0;
274
+ list-style: none;
275
+ }
276
+
277
+ .list-article {
278
+ display: flex;
279
+ gap: 1rem;
280
+ padding-block: 1.5rem;
281
+ }
282
+
283
+ .list-article + .list-article {
284
+ border-top: 1px solid var(--colour-border);
285
+ }
286
+
287
+ .list-article .article-title {
288
+ margin: 0;
289
+ }
290
+
291
+ .article-thumbnail img {
292
+ width: 8rem;
293
+ }
294
+
295
+ nav[aria-label="Pages"] ul {
296
+ display: flex;
297
+ gap: 0.5rem;
298
+ padding: 0;
299
+ list-style: none;
300
+ }
301
+
302
+ .site-footer {
303
+ padding-block: 1.5rem;
304
+ border-top: 1px solid var(--colour-border);
305
+ color: var(--colour-muted);
306
+ }
307
+
308
+ .site-footer nav {
309
+ display: flex;
310
+ flex-wrap: wrap;
311
+ gap: 1rem;
312
+ }
313
+
314
+ .colophon {
315
+ font-size: 0.875rem;
316
+ }
317
+
318
+ .colophon a:link,
319
+ .colophon a:visited {
320
+ color: var(--colour-muted);
321
+ text-decoration: none;
322
+ }
323
+
324
+ .colophon a:hover,
325
+ .colophon a:active {
326
+ color: var(--colour-link-hover);
327
+ text-decoration: none;
328
+ }
@@ -0,0 +1,69 @@
1
+ {% extends "layouts/html.njk" %}
2
+
3
+ {% block headTitle %}{{ list.name }} | {% if list.pagination.page.index > 1 %}Page {{ list.pagination.page.index }} | {% endif %}{{ site.name }}{% endblock %}
4
+
5
+ {% block breadcrumbItems %}
6
+ {% set typeSettings = site.types[list.type] %}
7
+ {% if list.kind != "type" %}
8
+ <li><a href="{{ typeSettings.url }}">{{ typeSettings.labelPlural }}</a></li>
9
+ {% endif %}
10
+ <li><a href="{{ list.url }}" aria-current="page">{{ list.name }}</a></li>
11
+ {% endblock %}
12
+
13
+ {% block main %}
14
+ <h1>{{ list.name }}</h1>
15
+ {% if list.kind == "tag" %}
16
+ <p>{{ site.types[list.type].labelPlural }} tagged "{{ list.name }}".</p>
17
+ {% elif list.kind == "author" %}
18
+ <p>{{ site.types[list.type].labelPlural }} by {{ list.name }}.</p>
19
+ {% endif %}
20
+
21
+ {% if list.articles.length %}
22
+ <ul class="list-articles">
23
+ {% for article in list.articles %}
24
+ <li class="list-article">
25
+ {% if article.thumbnail %}
26
+ <div class="article-thumbnail">
27
+ <a href="{{ article.url }}"><img src="{{ article.thumbnail }}" alt="" /></a>
28
+ </div>
29
+ {% endif %}
30
+ <div class="article-info">
31
+ <h2 class="article-title"><a href="{{ article.url }}">{{ article.title }}</a></h2>
32
+ <p class="article-meta">
33
+ <time datetime="{{ article.date }}">{{ article.date | date }}</time>
34
+ {% if article.author %}by {{ article.author.name }}{% endif %}
35
+ </p>
36
+ <div class="article-excerpt">
37
+ {{ article.excerptHtml | safe }}
38
+ <p><a class="button article-readmore" href="{{ article.url }}">Read more<span class="visually-hidden"> of {{ article.title }}</span></a></p>
39
+ </div>
40
+ </div>
41
+ </li>
42
+ {% endfor %}
43
+ </ul>
44
+ {% else %}
45
+ <p>No articles yet.</p>
46
+ {% endif %}
47
+
48
+ {% if list.pagination.pages.length > 1 %}
49
+ <nav aria-label="Pages">
50
+ <ul>
51
+ {% if list.pagination.prevPage %}
52
+ <li><a href="{{ list.pagination.prevPage.url }}" rel="prev">Previous</a></li>
53
+ {% endif %}
54
+ {% for page in list.pagination.pages %}
55
+ <li>
56
+ <a href="{{ page.url }}" title="View page {{ page.index }} of {{ list.pagination.pages.length }}"{% if page.isCurrent %} aria-current="page"{% endif %}>{{ page.index }}</a>
57
+ </li>
58
+ {% endfor %}
59
+ {% if list.pagination.nextPage %}
60
+ <li><a href="{{ list.pagination.nextPage.url }}" rel="next">Next</a></li>
61
+ {% endif %}
62
+ </ul>
63
+ </nav>
64
+ {% endif %}
65
+
66
+ {% if list.hasFeed %}
67
+ <p><a href="{{ list.feedUrl }}">RSS feed</a></p>
68
+ {% endif %}
69
+ {% endblock %}
@@ -0,0 +1,64 @@
1
+ {% extends "layouts/html.njk" %}
2
+
3
+ {% block headTitle %}{{ article.title }} | {{ site.name }}{% endblock %}
4
+
5
+ {% block headDescription %}{{ article.excerptText }}{% endblock %}
6
+
7
+ {% block breadcrumbItems %}
8
+ {% set typeSettings = site.types[article.type] %}
9
+ {% if typeSettings.generate.list %}
10
+ <li><a href="{{ typeSettings.url }}">{{ typeSettings.labelPlural }}</a></li>
11
+ {% endif %}
12
+ <li><a href="{{ article.url }}" aria-current="page">{{ article.title }}</a></li>
13
+ {% endblock %}
14
+
15
+ {% block main %}
16
+ <article>
17
+ <h1 class="article-title">{{ article.title }}</h1>
18
+
19
+ <div class="article-body">
20
+ {% block body %}
21
+ {{ article.bodyHtml | safe }}
22
+ {% endblock %}
23
+ </div>
24
+
25
+ {% block attachments %}
26
+ {% if article.attachments.length %}
27
+ <h2>Attachments</h2>
28
+ <ul class="article-attachments">
29
+ {% for attachment in article.attachments %}
30
+ <li>
31
+ <a href="{{ attachment.url }}">
32
+ {% if attachment.thumbnail %}<img src="{{ attachment.thumbnail }}" alt="" />{% endif %}
33
+ {{ attachment.name }}
34
+ </a>
35
+ ({{ attachment.mimeType }}{% if attachment.sizeRelative %}, {{ attachment.sizeRelative }}{% endif %})
36
+ </li>
37
+ {% endfor %}
38
+ </ul>
39
+ {% endif %}
40
+ {% endblock %}
41
+ </article>
42
+ {% endblock %}
43
+
44
+ {% block aside %}
45
+ <aside>
46
+ <dl>
47
+ {% if article.author %}
48
+ <dt>Author</dt>
49
+ <dd>
50
+ {{ article.author.name }}
51
+ {% if article.author.url %}(<a href="{{ article.author.url }}" rel="author">website</a>){% endif %}
52
+ </dd>
53
+ {% endif %}
54
+ <dt>Date</dt>
55
+ <dd><time datetime="{{ article.date }}">{{ article.date | date }}</time></dd>
56
+ {% if article.tags.length %}
57
+ <dt>Tagged</dt>
58
+ <dd>
59
+ {% for tag in article.tags %}{% if site.types[article.type].generate.tag %}<a href="{{ tag.url }}">{{ tag.name }}</a>{% else %}{{ tag.name }}{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}
60
+ </dd>
61
+ {% endif %}
62
+ </dl>
63
+ </aside>
64
+ {% endblock %}
@@ -0,0 +1,72 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>{% block headTitle %}{{ site.name }}{% endblock %}</title>
7
+ <meta name="description" content="{% block headDescription %}{{ site.description }}{% endblock %}" />
8
+
9
+ {% if list and list.hasFeed %}
10
+ <link rel="alternate" type="application/rss+xml" title="{{ list.name }} | {{ site.name }}" href="{{ list.feedUrl }}" />
11
+ {% endif %}
12
+
13
+ {% block headImports %}
14
+ <link rel="stylesheet" href="{{ site.baseUrl }}/base.css" />
15
+ {% endblock %}
16
+ {% embedHead %}
17
+ </head>
18
+ <body class="{% if type %}{{ type }} {% endif %}{% block bodyClass %}{% endblock %}">
19
+ {% block header %}
20
+ <header class="site-header">
21
+ <h1 class="site-title">
22
+ <a href="{{ site.url }}">{{ site.name }}<span class="leaf-device"></span></a>
23
+ </h1>
24
+ </header>
25
+ {% block headerNav %}{% endblock %}
26
+ {% endblock %}
27
+
28
+ {% block content %}
29
+ <div class="site-content">
30
+ <main class="site-main">
31
+ {% block breadcrumb %}
32
+ <nav class="site-breadcrumb" aria-label="Breadcrumb">
33
+ <ul>
34
+ <li><a href="{{ site.path }}">{{ site.name }}</a></li>
35
+ {% block breadcrumbItems %}{% endblock %}
36
+ </ul>
37
+ </nav>
38
+ {% endblock %}
39
+
40
+ {% block main %}{% endblock %}
41
+ </main>
42
+
43
+ {% block aside %}{% endblock %}
44
+ </div>
45
+ {% endblock %}
46
+
47
+ {% block footer %}
48
+ <footer class="site-footer">
49
+ {% block footerNav %}
50
+ <nav aria-label="Sections">
51
+ {% for name, type in site.types %}
52
+ {% if type.generate.list %}
53
+ <a href="{{ type.url }}">{{ type.labelPlural }}</a>
54
+ {% endif %}
55
+ {% endfor %}
56
+ </nav>
57
+ {% endblock %}
58
+
59
+ {% block colophon %}
60
+ <p class="colophon">
61
+ <a href="{{ site.url }}">{{ site.name }}</a>
62
+ &middot;
63
+ Built with <a href="https://lvl99.github.io/edaha.md" target="_blank" rel="noopener noreferrer">edaha.md</a>
64
+ </p>
65
+ {% endblock %}
66
+ </footer>
67
+ {% endblock %}
68
+
69
+ {% block bodyImports %}{% endblock %}
70
+ {% embedFoot %}
71
+ </body>
72
+ </html>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
3
+ <channel>
4
+ <title>{{ list.name }} | {{ site.name }}</title>
5
+ <link>{{ list.url | absoluteUrl(site.url) }}</link>
6
+ <description>{{ site.description }}</description>
7
+ <language>en</language>
8
+ <atom:link href="{{ list.feedUrl | absoluteUrl(site.url) }}" rel="self" type="application/rss+xml" />
9
+ {% if list.articles.length %}
10
+ <lastBuildDate>{{ list.articles[0].date | rfc822 }}</lastBuildDate>
11
+ {% endif %}
12
+ {% for article in list.articles %}
13
+ <item>
14
+ <title>{{ article.title }}</title>
15
+ <link>{{ article.url | absoluteUrl(site.url) }}</link>
16
+ <guid isPermaLink="true">{{ article.url | absoluteUrl(site.url) }}</guid>
17
+ <pubDate>{{ article.date | rfc822 }}</pubDate>
18
+ {% if article.author and article.author.email %}
19
+ <author>{{ article.author.email }} ({{ article.author.name }})</author>
20
+ {% endif %}
21
+ {% for tag in article.tags %}
22
+ <category>{{ tag.name }}</category>
23
+ {% endfor %}
24
+ <description>{{ article.excerptHtml | absoluteUrls(site.url) }}</description>
25
+ </item>
26
+ {% endfor %}
27
+ </channel>
28
+ </rss>
@@ -0,0 +1,16 @@
1
+ {# The website's front page: its title and body, without the header or breadcrumbs #}
2
+ {% extends "layouts/html.njk" %}
3
+
4
+ {% block headTitle %}{{ site.name }} | {{ article.title }}{% endblock %}
5
+
6
+ {% block headDescription %}{{ site.description }}{% endblock %}
7
+
8
+ {% block bodyClass %}home{% endblock %}
9
+
10
+ {% block breadcrumb %}{% endblock %}
11
+
12
+ {% block main %}
13
+ <div class="home-body">
14
+ {{ article.bodyHtml | safe }}
15
+ </div>
16
+ {% endblock %}
@@ -0,0 +1,18 @@
1
+ {% extends "layouts/html.njk" %}
2
+
3
+ {% block headTitle %}{{ article.title }} | {{ site.name }}{% endblock %}
4
+
5
+ {% block headDescription %}{{ article.excerptText }}{% endblock %}
6
+
7
+ {% block breadcrumbItems %}
8
+ <li><a href="{{ article.url }}" aria-current="page">{{ article.title }}</a></li>
9
+ {% endblock %}
10
+
11
+ {% block main %}
12
+ <article>
13
+ <h1 class="article-title">{{ article.title }}</h1>
14
+ <p class="article-updated">Last updated: <time datetime="{{ article.date }}">{{ article.date | date }}</time></p>
15
+
16
+ {{ article.bodyHtml | safe }}
17
+ </article>
18
+ {% endblock %}