@lvl99dotcom/edaha.md 0.1.0 → 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.
- package/LICENSE +183 -183
- package/README.md +7 -252
- package/dist/cli/index.d.ts +36 -6
- package/dist/cli/index.js +48 -9
- package/dist/embeds/blocks/index.d.ts +59 -0
- package/dist/embeds/blocks/index.js +103 -0
- package/dist/embeds/index.d.ts +122 -19
- package/dist/embeds/index.js +381 -41
- package/dist/embeds/types/index.d.ts +111 -8
- package/dist/generator/article/index.d.ts +52 -12
- package/dist/generator/article/index.js +94 -26
- package/dist/generator/build/index.d.ts +55 -23
- package/dist/generator/build/index.js +151 -81
- package/dist/generator/config/index.d.ts +45 -8
- package/dist/generator/config/index.js +152 -30
- package/dist/generator/configFile/index.d.ts +58 -0
- package/dist/generator/configFile/index.js +122 -0
- package/dist/generator/fields/index.d.ts +93 -0
- package/dist/generator/fields/index.js +186 -0
- package/dist/generator/format/index.d.ts +40 -0
- package/dist/generator/format/index.js +75 -0
- package/dist/generator/lists/index.d.ts +3 -3
- package/dist/generator/lists/index.js +9 -8
- package/dist/generator/markdown/index.d.ts +8 -3
- package/dist/generator/markdown/index.js +11 -4
- package/dist/generator/metadata/index.d.ts +150 -0
- package/dist/generator/metadata/index.js +361 -0
- package/dist/generator/metadataGroups/index.d.ts +45 -0
- package/dist/generator/metadataGroups/index.js +169 -0
- package/dist/generator/templates/index.d.ts +35 -3
- package/dist/generator/templates/index.js +72 -6
- package/dist/generator/types/index.d.ts +43 -18
- package/dist/generator/urls/index.d.ts +18 -8
- package/dist/generator/urls/index.js +22 -12
- package/dist/index.d.ts +5 -7
- package/dist/index.js +6 -7
- package/package.json +18 -47
- package/theme/static/{site.css → base.css} +132 -24
- package/theme/templates/article/list.njk +6 -6
- package/theme/templates/article/single.njk +13 -7
- package/theme/templates/layouts/html.njk +54 -32
- package/theme/templates/layouts/rssfeed.njk +7 -7
- package/theme/templates/page/home.njk +2 -7
- package/theme/templates/page/single.njk +2 -2
- package/dist/client/assets/index-BbKEbPS8.css +0 -1
- package/dist/client/assets/index-DtG7vi1d.js +0 -559
- package/dist/client/index.html +0 -13
- package/dist/editor/index.d.ts +0 -62
- package/dist/editor/index.js +0 -102
- package/dist/embeds/bandcamp/index.d.ts +0 -9
- package/dist/embeds/bandcamp/index.js +0 -28
- package/dist/embeds/youtube/index.d.ts +0 -17
- package/dist/embeds/youtube/index.js +0 -48
- package/dist/server/app/index.d.ts +0 -39
- package/dist/server/app/index.js +0 -138
- package/dist/server/convert/index.d.ts +0 -25
- package/dist/server/convert/index.js +0 -125
- package/dist/server/store/index.d.ts +0 -148
- package/dist/server/store/index.js +0 -411
- package/dist/server/types/index.d.ts +0 -76
- package/dist/server/types/index.js +0 -1
|
@@ -10,16 +10,77 @@ export const REQUIRED_TEMPLATES = [
|
|
|
10
10
|
"article/list.njk",
|
|
11
11
|
];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Template names starting with this always load from the last template folder (the default theme's), e.g.
|
|
14
|
+
* `{% extends "@theme/article/single.njk" %}` in a site's own `article/single.njk`, to build on the theme's version.
|
|
15
|
+
*/
|
|
16
|
+
export const THEME_PREFIX = "@theme/";
|
|
17
|
+
/**
|
|
18
|
+
* A Nunjucks loader for template names starting with THEME_PREFIX, from one folder. Other names are left to the next
|
|
19
|
+
* loader.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* themeLoader("/theme/templates").getSource("@theme/article/single.njk"); // the theme's article/single.njk
|
|
23
|
+
*/
|
|
24
|
+
export const themeLoader = (dir) => {
|
|
25
|
+
const files = new nunjucks.FileSystemLoader(dir);
|
|
26
|
+
return {
|
|
27
|
+
getSource: (name) => name.startsWith(THEME_PREFIX)
|
|
28
|
+
? files.getSource(name.slice(THEME_PREFIX.length))
|
|
29
|
+
: // Nunjucks' loaders answer null for templates they don't have
|
|
30
|
+
null,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Make a root-relative URL absolute on the website's domain, e.g. for RSS feeds read outside the website. Template
|
|
35
|
+
* data URLs already start with the website's base URL, so only its origin is added.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* absoluteUrl("/news/", "https://example.com"); // "https://example.com/news/"
|
|
39
|
+
* absoluteUrl("/edaha.md/news/", "https://lvl99.github.io/edaha.md"); // "https://lvl99.github.io/edaha.md/news/"
|
|
40
|
+
*/
|
|
41
|
+
export const absoluteUrl = (url, siteUrl) => new URL(url, siteUrl).href;
|
|
42
|
+
/**
|
|
43
|
+
* Make root-relative `href` and `src` URLs in HTML absolute (see absoluteUrl), e.g. for RSS feeds read outside the
|
|
44
|
+
* website.
|
|
14
45
|
*
|
|
15
46
|
* @example
|
|
16
47
|
* absoluteUrls('<a href="/news/">', "https://example.com"); // '<a href="https://example.com/news/">'
|
|
17
48
|
*/
|
|
18
|
-
export const absoluteUrls = (html, siteUrl) => html.replace(/(\s(?:href|src)=")\/(?!\/)/g, `$1${siteUrl}/`);
|
|
49
|
+
export const absoluteUrls = (html, siteUrl) => html.replace(/(\s(?:href|src)=")\/(?!\/)/g, `$1${new URL(siteUrl).origin}/`);
|
|
50
|
+
/** Template tags that output the page's embed HTML (`TemplateData.embeds`), by where it goes */
|
|
51
|
+
export const EMBED_TAGS = {
|
|
52
|
+
embedHead: "head",
|
|
53
|
+
embedFoot: "foot",
|
|
54
|
+
// The names the brief's first draft used
|
|
55
|
+
embedRenderHead: "head",
|
|
56
|
+
embedRenderFoot: "foot",
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The `{% embedHead %}` and `{% embedFoot %}` tags (also `{% embedRenderHead() %}` and `{% embedRenderFoot() %}`): output
|
|
60
|
+
* the HTML that the page's embeds need once in its `<head>`, or before `</body>`. They output nothing on pages without
|
|
61
|
+
* embeds.
|
|
62
|
+
*/
|
|
63
|
+
class EmbedTags {
|
|
64
|
+
tags = Object.keys(EMBED_TAGS);
|
|
65
|
+
/** Read the tag (with or without empty brackets) */
|
|
66
|
+
parse(parser, nodes) {
|
|
67
|
+
const token = parser.nextToken();
|
|
68
|
+
// Brackets are optional, and the tags take no arguments
|
|
69
|
+
const args = parser.parseSignature(true, false) ??
|
|
70
|
+
new nodes.NodeList(token.lineno, token.colno);
|
|
71
|
+
parser.advanceAfterBlockEnd(token.value);
|
|
72
|
+
return new nodes.CallExtension(this, token.value, args, []);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const [tag, part] of Object.entries(EMBED_TAGS))
|
|
76
|
+
Object.defineProperty(EmbedTags.prototype, tag, {
|
|
77
|
+
value: (context) => new nunjucks.runtime.SafeString(context.ctx.embeds?.[part] ?? ""),
|
|
78
|
+
});
|
|
19
79
|
/**
|
|
20
|
-
* Loads and renders the
|
|
80
|
+
* Loads and renders the site's Nunjucks templates from one or more folders. A file in an earlier folder overrides the
|
|
21
81
|
* same file in later ones (e.g. a site's templates over the default theme's). Falls back to the `article` templates
|
|
22
|
-
* (with a warning) when an article type has none of its own.
|
|
82
|
+
* (with a warning) when an article type has none of its own. Names starting with THEME_PREFIX (`@theme/`) load from
|
|
83
|
+
* the last folder only.
|
|
23
84
|
*
|
|
24
85
|
* @example
|
|
25
86
|
* const templates = new Templates(["site/templates", join(THEME_DIR, "templates")], console);
|
|
@@ -39,7 +100,10 @@ export class Templates {
|
|
|
39
100
|
if (missing.length)
|
|
40
101
|
throw new Error(`Missing required templates in ${this.dirs.join(", ")}: ${missing.join(", ")}`);
|
|
41
102
|
this.logger = logger;
|
|
42
|
-
this.env = new nunjucks.Environment(
|
|
103
|
+
this.env = new nunjucks.Environment([
|
|
104
|
+
themeLoader(this.dirs.at(-1)),
|
|
105
|
+
new nunjucks.FileSystemLoader(this.dirs),
|
|
106
|
+
], {
|
|
43
107
|
autoescape: true,
|
|
44
108
|
// Keep the generated HTML free of blank lines left by template tags
|
|
45
109
|
trimBlocks: true,
|
|
@@ -47,7 +111,9 @@ export class Templates {
|
|
|
47
111
|
});
|
|
48
112
|
this.env.addFilter("date", formatDate);
|
|
49
113
|
this.env.addFilter("rfc822", formatRfc822);
|
|
114
|
+
this.env.addFilter("absoluteUrl", absoluteUrl);
|
|
50
115
|
this.env.addFilter("absoluteUrls", absoluteUrls);
|
|
116
|
+
this.env.addExtension("embeds", new EmbedTags());
|
|
51
117
|
}
|
|
52
118
|
/**
|
|
53
119
|
* Whether a template file or folder exists in any of the template folders.
|
|
@@ -72,7 +138,7 @@ export class Templates {
|
|
|
72
138
|
return file;
|
|
73
139
|
const fallback = `article/${name}.njk`;
|
|
74
140
|
if (!this.exists(fallback))
|
|
75
|
-
throw new Error(`Template "${name}" not found
|
|
141
|
+
throw new Error(`Template "${name}" not found: looked for ${file} and ${fallback} in ${this.dirs.join(" and ")}`);
|
|
76
142
|
if (this.exists(type) && !this.warned.has(file)) {
|
|
77
143
|
this.warned.add(file);
|
|
78
144
|
this.logger.warn(`Template ${file} not found; using ${fallback}`);
|
|
@@ -1,8 +1,32 @@
|
|
|
1
|
+
import type { EmbedPageParts } from "../../embeds/types/index.ts";
|
|
1
2
|
import type { ArticleTypeConfig, GenerateConfig } from "../config/index.ts";
|
|
2
3
|
/** Website data */
|
|
3
4
|
export interface TemplateDataSite {
|
|
4
|
-
/** The
|
|
5
|
+
/** The name of the website */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The website description */
|
|
8
|
+
description: string;
|
|
9
|
+
/** The website's absolute URL, without a trailing slash, e.g. "https://example.com" */
|
|
5
10
|
url: string;
|
|
11
|
+
/**
|
|
12
|
+
* The URL path the website lives under: `url`'s path without a trailing slash, e.g. "/edaha.md", or "" at a domain's
|
|
13
|
+
* root. Every URL in the template data already starts with it; use it for the site's static files, e.g.
|
|
14
|
+
* `{{ site.baseUrl }}/base.css`.
|
|
15
|
+
*/
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
/** The URL of the site's home: "/", or its `path` setting's folder, e.g. "/docs/" (after `baseUrl`) */
|
|
18
|
+
path: string;
|
|
19
|
+
/** Article type settings (configured types, plus any other types articles use) */
|
|
20
|
+
types: Record<string, TemplateDataArticleType>;
|
|
21
|
+
/**
|
|
22
|
+
* The author of articles that don't name one (unless their type has its own): the config file's `author`, the
|
|
23
|
+
* website's name without one, or undefined when it is `false`
|
|
24
|
+
*/
|
|
25
|
+
author?: {
|
|
26
|
+
name: string;
|
|
27
|
+
email?: string | undefined;
|
|
28
|
+
url?: string | undefined;
|
|
29
|
+
} | undefined;
|
|
6
30
|
}
|
|
7
31
|
/** What is built for an article type */
|
|
8
32
|
export type TemplateDataArticleTypeGenerationConfig = GenerateConfig;
|
|
@@ -11,19 +35,6 @@ export interface TemplateDataArticleType extends ArticleTypeConfig {
|
|
|
11
35
|
/** The URL of the type's front page (its list or index article), e.g. "/news/" */
|
|
12
36
|
url: string;
|
|
13
37
|
}
|
|
14
|
-
/** Blog data */
|
|
15
|
-
export interface TemplateDataBlog {
|
|
16
|
-
/** The name of the website */
|
|
17
|
-
name: string;
|
|
18
|
-
/** The website description */
|
|
19
|
-
description: string;
|
|
20
|
-
/** The blog's URL path prefix ("" for the website's root) */
|
|
21
|
-
path: string;
|
|
22
|
-
/** The URL of the blog's root, e.g. "/" */
|
|
23
|
-
url: string;
|
|
24
|
-
/** Article type settings (configured types, plus any other types articles use) */
|
|
25
|
-
types: Record<string, TemplateDataArticleType>;
|
|
26
|
-
}
|
|
27
38
|
/** An article's author */
|
|
28
39
|
export interface TemplateDataAuthor {
|
|
29
40
|
/** The author's name */
|
|
@@ -79,8 +90,8 @@ export interface TemplateDataArticle {
|
|
|
79
90
|
url: string;
|
|
80
91
|
/** The article title */
|
|
81
92
|
title: string;
|
|
82
|
-
/** The article author */
|
|
83
|
-
author
|
|
93
|
+
/** The article's author: its own, its type's or the website's default, or undefined for none */
|
|
94
|
+
author?: TemplateDataAuthor | undefined;
|
|
84
95
|
/** The article thumbnail URL */
|
|
85
96
|
thumbnail?: string | undefined;
|
|
86
97
|
/** The article tags */
|
|
@@ -99,6 +110,11 @@ export interface TemplateDataArticle {
|
|
|
99
110
|
bodyHtml: string;
|
|
100
111
|
/** Article attachments */
|
|
101
112
|
attachments: TemplateDataAttachment[];
|
|
113
|
+
/**
|
|
114
|
+
* The article's custom metadata (see the config file's `metadata`): the valid values of the fields its type uses, by
|
|
115
|
+
* key, with file fields as paths on the website
|
|
116
|
+
*/
|
|
117
|
+
meta: Record<string, unknown>;
|
|
102
118
|
}
|
|
103
119
|
/** One page of a paginated list */
|
|
104
120
|
export interface TemplateDataPaginationPage {
|
|
@@ -147,12 +163,21 @@ export interface TemplateDataList {
|
|
|
147
163
|
export interface TemplateData {
|
|
148
164
|
/** Website data, always provided */
|
|
149
165
|
site: TemplateDataSite;
|
|
150
|
-
/**
|
|
151
|
-
|
|
166
|
+
/** The page's article type, e.g. "news": the article's or the list's */
|
|
167
|
+
type: string;
|
|
168
|
+
/** Whether the page is an article's page (index articles and editor previews included) */
|
|
169
|
+
isArticle: boolean;
|
|
170
|
+
/** Whether the page is a list's page or feed */
|
|
171
|
+
isList: boolean;
|
|
152
172
|
/** List data, provided when rendering list and feed templates, and index articles (the first page of their type's list) */
|
|
153
173
|
list?: TemplateDataList;
|
|
154
174
|
/** Article data, only provided when rendering single templates */
|
|
155
175
|
article?: TemplateDataArticle;
|
|
176
|
+
/**
|
|
177
|
+
* HTML the page's embeds need once, output by the `{% embedHead %}` and `{% embedFoot %}` tags. Not provided for
|
|
178
|
+
* feeds.
|
|
179
|
+
*/
|
|
180
|
+
embeds?: EmbedPageParts | undefined;
|
|
156
181
|
}
|
|
157
182
|
/** Where build warnings go */
|
|
158
183
|
export interface Logger {
|
|
@@ -10,31 +10,41 @@ export declare const RESERVED_SLUGS: string[];
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const folderPath: (...segments: string[]) => string;
|
|
12
12
|
/**
|
|
13
|
-
* The root-relative URL of a folder path.
|
|
13
|
+
* The root-relative URL of a folder path, under the website's base URL (see baseUrlOf).
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* folderUrl("news/"); // "/news/"
|
|
17
17
|
* folderUrl(""); // "/"
|
|
18
|
+
* folderUrl("news/", "/edaha.md"); // "/edaha.md/news/"
|
|
18
19
|
*/
|
|
19
|
-
export declare const folderUrl: (folder: string) => string;
|
|
20
|
+
export declare const folderUrl: (folder: string, baseUrl?: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* The URL path a website lives under: its absolute URL's path, without a trailing slash, or "" at a domain's root.
|
|
23
|
+
* Every URL in its pages starts with it, e.g. for a website in a sub-folder like a GitHub Pages project site.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* baseUrlOf("https://lvl99.github.io/edaha.md"); // "/edaha.md"
|
|
27
|
+
* baseUrlOf("https://example.com/"); // ""
|
|
28
|
+
*/
|
|
29
|
+
export declare const baseUrlOf: (siteUrl: string) => string;
|
|
20
30
|
/**
|
|
21
31
|
* Check article types' URL paths: no two the same, and none clashing with the website's reserved paths at its root
|
|
22
|
-
* (`reservedPaths` in config
|
|
32
|
+
* (`reservedPaths` in the config file). Throws an Error describing the first problem.
|
|
23
33
|
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param reservedPaths - paths at the website's root that the
|
|
34
|
+
* @param sitePath - the site's URL path prefix
|
|
35
|
+
* @param reservedPaths - paths at the website's root that the site can't use, e.g. another app's routes
|
|
26
36
|
*
|
|
27
37
|
* @example
|
|
28
38
|
* checkTypePaths("", { app: defaultTypeConfig("app") }, ["app"]); // throws: type "app" can't use the path "app"
|
|
29
39
|
*/
|
|
30
|
-
export declare const checkTypePaths: (
|
|
40
|
+
export declare const checkTypePaths: (sitePath: string, types: Record<string, ArticleTypeConfig>, reservedPaths?: readonly string[]) => void;
|
|
31
41
|
/**
|
|
32
42
|
* Why an article slug can't be used in a type, or undefined if it can. Slugs can't be the tag and author list folders
|
|
33
43
|
* or numbers (list pages), and at the website's root, its reserved paths or another type's path.
|
|
34
44
|
*
|
|
35
|
-
* @param reservedPaths - paths at the website's root that the
|
|
45
|
+
* @param reservedPaths - paths at the website's root that the site can't use (`reservedPaths` in the config file)
|
|
36
46
|
*
|
|
37
47
|
* @example
|
|
38
48
|
* slugProblem("tags", "news", "", types); // 'the slug "tags" is used by tag lists'
|
|
39
49
|
*/
|
|
40
|
-
export declare const slugProblem: (slug: string, type: string,
|
|
50
|
+
export declare const slugProblem: (slug: string, type: string, sitePath: string, types: Record<string, ArticleTypeConfig>, reservedPaths?: readonly string[]) => string | undefined;
|
|
@@ -12,50 +12,60 @@ export const folderPath = (...segments) => segments
|
|
|
12
12
|
.map((segment) => `${segment}/`)
|
|
13
13
|
.join("");
|
|
14
14
|
/**
|
|
15
|
-
* The root-relative URL of a folder path.
|
|
15
|
+
* The root-relative URL of a folder path, under the website's base URL (see baseUrlOf).
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* folderUrl("news/"); // "/news/"
|
|
19
19
|
* folderUrl(""); // "/"
|
|
20
|
+
* folderUrl("news/", "/edaha.md"); // "/edaha.md/news/"
|
|
20
21
|
*/
|
|
21
|
-
export const folderUrl = (folder) =>
|
|
22
|
+
export const folderUrl = (folder, baseUrl = "") => `${baseUrl}/${folder}`;
|
|
23
|
+
/**
|
|
24
|
+
* The URL path a website lives under: its absolute URL's path, without a trailing slash, or "" at a domain's root.
|
|
25
|
+
* Every URL in its pages starts with it, e.g. for a website in a sub-folder like a GitHub Pages project site.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* baseUrlOf("https://lvl99.github.io/edaha.md"); // "/edaha.md"
|
|
29
|
+
* baseUrlOf("https://example.com/"); // ""
|
|
30
|
+
*/
|
|
31
|
+
export const baseUrlOf = (siteUrl) => new URL(siteUrl).pathname.replace(/\/+$/, "");
|
|
22
32
|
/**
|
|
23
33
|
* Check article types' URL paths: no two the same, and none clashing with the website's reserved paths at its root
|
|
24
|
-
* (`reservedPaths` in config
|
|
34
|
+
* (`reservedPaths` in the config file). Throws an Error describing the first problem.
|
|
25
35
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param reservedPaths - paths at the website's root that the
|
|
36
|
+
* @param sitePath - the site's URL path prefix
|
|
37
|
+
* @param reservedPaths - paths at the website's root that the site can't use, e.g. another app's routes
|
|
28
38
|
*
|
|
29
39
|
* @example
|
|
30
40
|
* checkTypePaths("", { app: defaultTypeConfig("app") }, ["app"]); // throws: type "app" can't use the path "app"
|
|
31
41
|
*/
|
|
32
|
-
export const checkTypePaths = (
|
|
42
|
+
export const checkTypePaths = (sitePath, types, reservedPaths = []) => {
|
|
33
43
|
const seen = new Map();
|
|
34
44
|
for (const [type, { path }] of Object.entries(types)) {
|
|
35
45
|
const other = seen.get(path);
|
|
36
46
|
if (other !== undefined)
|
|
37
|
-
throw new Error(`
|
|
47
|
+
throw new Error(`types "${other}" and "${type}" have the same path "${path}"`);
|
|
38
48
|
seen.set(path, type);
|
|
39
|
-
if (!
|
|
40
|
-
throw new Error(`
|
|
49
|
+
if (!sitePath && reservedPaths.includes(path))
|
|
50
|
+
throw new Error(`type "${type}" can't use the path "${path}", which is reserved`);
|
|
41
51
|
}
|
|
42
52
|
};
|
|
43
53
|
/**
|
|
44
54
|
* Why an article slug can't be used in a type, or undefined if it can. Slugs can't be the tag and author list folders
|
|
45
55
|
* or numbers (list pages), and at the website's root, its reserved paths or another type's path.
|
|
46
56
|
*
|
|
47
|
-
* @param reservedPaths - paths at the website's root that the
|
|
57
|
+
* @param reservedPaths - paths at the website's root that the site can't use (`reservedPaths` in the config file)
|
|
48
58
|
*
|
|
49
59
|
* @example
|
|
50
60
|
* slugProblem("tags", "news", "", types); // 'the slug "tags" is used by tag lists'
|
|
51
61
|
*/
|
|
52
|
-
export const slugProblem = (slug, type,
|
|
62
|
+
export const slugProblem = (slug, type, sitePath, types, reservedPaths = []) => {
|
|
53
63
|
if (RESERVED_SLUGS.includes(slug))
|
|
54
64
|
return `the slug "${slug}" is used by ${slug === "tags" ? "tag" : "author"} lists`;
|
|
55
65
|
if (/^\d+$/.test(slug))
|
|
56
66
|
return `the slug "${slug}" is used by list pages`;
|
|
57
67
|
// A type that isn't configured is at its own name
|
|
58
|
-
const atRoot = !
|
|
68
|
+
const atRoot = !sitePath && !(types[type]?.path ?? type);
|
|
59
69
|
if (atRoot && reservedPaths.includes(slug))
|
|
60
70
|
return `the slug "${slug}" is reserved`;
|
|
61
71
|
if (atRoot) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { parseConfig, type ArticleTypeConfig, type
|
|
1
|
+
export { buildSite, DEFAULT_SITE_URL, type BuildOptions, type BuildResult, } from "./generator/build/index.ts";
|
|
2
|
+
export { parseConfig, type ArticleTypeConfig, type EdahaConfig, type GenerateConfig, } from "./generator/config/index.ts";
|
|
3
|
+
export { CONFIG_FILES, findConfigFile, loadSiteConfig, readConfigFile, type SiteConfig, type SiteConfigOptions, } from "./generator/configFile/index.ts";
|
|
3
4
|
export { REQUIRED_TEMPLATES } from "./generator/templates/index.ts";
|
|
4
5
|
export type * from "./generator/types/index.ts";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export { bandcamp } from "./embeds/bandcamp/index.ts";
|
|
8
|
-
export { createEditorServer, EDITOR_HOST, EDITOR_PORT, startEditor, type EditorServer, type EditorServerOptions, } from "./editor/index.ts";
|
|
9
|
-
export { runCli, type CliContext } from "./cli/index.ts";
|
|
6
|
+
export { EMBED_BLOCK, EmbedResolver, embedBlock, isEmbedPlugin, loadPlugins, validationErrors, type EmbedBuildRenderers, type EmbedContext, type EmbedEditorRenderers, type EmbedPageContext, type EmbedPageParts, type EmbedPlugin, type EmbedRenderContext, type EmbedSources, } from "./embeds/index.ts";
|
|
7
|
+
export { EDITOR_PACKAGE, EDITOR_PORT, loadEditor, runCli, type CliContext, type EditorOptions, type RunningEditor, type StartEditor, } from "./cli/index.ts";
|
|
10
8
|
export { THEME_DIR } from "./theme/index.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// edaha.md's public API: build a site from Markdown articles, run the
|
|
2
|
-
|
|
1
|
+
// edaha.md's public API: build a site from Markdown articles, run the `edaha` command, and write embed plugins. The
|
|
2
|
+
// article editor is in its own package, @lvl99dotcom/edaha-editor.
|
|
3
|
+
export { buildSite, DEFAULT_SITE_URL, } from "./generator/build/index.js";
|
|
3
4
|
export { parseConfig, } from "./generator/config/index.js";
|
|
5
|
+
export { CONFIG_FILES, findConfigFile, loadSiteConfig, readConfigFile, } from "./generator/configFile/index.js";
|
|
4
6
|
export { REQUIRED_TEMPLATES } from "./generator/templates/index.js";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export { bandcamp } from "./embeds/bandcamp/index.js";
|
|
8
|
-
export { createEditorServer, EDITOR_HOST, EDITOR_PORT, startEditor, } from "./editor/index.js";
|
|
9
|
-
export { runCli } from "./cli/index.js";
|
|
7
|
+
export { EMBED_BLOCK, EmbedResolver, embedBlock, isEmbedPlugin, loadPlugins, validationErrors, } from "./embeds/index.js";
|
|
8
|
+
export { EDITOR_PACKAGE, EDITOR_PORT, loadEditor, runCli, } from "./cli/index.js";
|
|
10
9
|
export { THEME_DIR } from "./theme/index.js";
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvl99dotcom/edaha.md",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Static
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Static site generator using markdown.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blog",
|
|
7
7
|
"static-site-generator",
|
|
8
8
|
"markdown",
|
|
9
9
|
"nunjucks",
|
|
10
|
-
"rss"
|
|
11
|
-
"editor"
|
|
10
|
+
"rss"
|
|
12
11
|
],
|
|
13
12
|
"author": "Matt Scheurich <matt@lvl99.com>",
|
|
14
13
|
"license": "Apache-2.0",
|
|
15
14
|
"repository": {
|
|
16
15
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/lvl99/edaha.md.git"
|
|
16
|
+
"url": "git+https://github.com/lvl99/edaha.md.git",
|
|
17
|
+
"directory": "packages/edaha"
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/lvl99/edaha.md#readme",
|
|
20
20
|
"bugs": "https://github.com/lvl99/edaha.md/issues",
|
|
@@ -30,7 +30,11 @@
|
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
31
|
"default": "./dist/index.js"
|
|
32
32
|
},
|
|
33
|
-
"./package.json": "./package.json"
|
|
33
|
+
"./package.json": "./package.json",
|
|
34
|
+
"./*": {
|
|
35
|
+
"types": "./dist/*/index.d.ts",
|
|
36
|
+
"default": "./dist/*/index.js"
|
|
37
|
+
}
|
|
34
38
|
},
|
|
35
39
|
"files": [
|
|
36
40
|
"dist",
|
|
@@ -42,55 +46,22 @@
|
|
|
42
46
|
"access": "public"
|
|
43
47
|
},
|
|
44
48
|
"dependencies": {
|
|
45
|
-
"
|
|
46
|
-
"
|
|
49
|
+
"ajv": "^8.20.0",
|
|
50
|
+
"ajv-formats": "^3.0.1",
|
|
47
51
|
"markdown-it": "^15.0.3",
|
|
48
52
|
"mime-types": "^3.0.2",
|
|
49
53
|
"nunjucks": "^3.2.4",
|
|
50
|
-
"turndown": "^7.2.4",
|
|
51
54
|
"yaml": "^2.9.1"
|
|
52
55
|
},
|
|
53
|
-
"
|
|
54
|
-
"@
|
|
55
|
-
"@tiptap/core": "^3.32.0",
|
|
56
|
-
"@tiptap/extension-details": "3.32.0",
|
|
57
|
-
"@tiptap/extension-image": "^3.32.0",
|
|
58
|
-
"@tiptap/extension-table": "^3.32.0",
|
|
59
|
-
"@tiptap/pm": "^3.32.0",
|
|
60
|
-
"@tiptap/starter-kit": "^3.32.0",
|
|
61
|
-
"@types/markdown-it": "^14.1.2",
|
|
62
|
-
"@types/mime-types": "^3.0.1",
|
|
63
|
-
"@types/node": "^26.1.1",
|
|
64
|
-
"@types/nunjucks": "^3.2.6",
|
|
65
|
-
"@types/turndown": "^5.0.6",
|
|
66
|
-
"@vitest/coverage-v8": "^4.1.12",
|
|
67
|
-
"eslint": "^10.13.0",
|
|
68
|
-
"eslint-config-prettier": "^10.1.8",
|
|
69
|
-
"eslint-plugin-lit": "^2.3.1",
|
|
70
|
-
"globals": "^17.13.0",
|
|
71
|
-
"jsdom": "^30.1.3",
|
|
72
|
-
"lit": "^3.3.3",
|
|
73
|
-
"prettier": "^3.9.10",
|
|
74
|
-
"typescript": "~6.0.3",
|
|
75
|
-
"typescript-eslint": "^8.71.2",
|
|
76
|
-
"vite": "^8.1.4",
|
|
77
|
-
"vitest": "^4.1.12"
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@lvl99dotcom/edaha-editor": "^0.2.0"
|
|
78
58
|
},
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"version": "12.18.0",
|
|
83
|
-
"onFail": "download"
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@lvl99dotcom/edaha-editor": {
|
|
61
|
+
"optional": true
|
|
84
62
|
}
|
|
85
63
|
},
|
|
86
64
|
"scripts": {
|
|
87
|
-
"build": "node scripts/build.ts"
|
|
88
|
-
"dev:editor": "vite",
|
|
89
|
-
"typecheck": "tsc -p .",
|
|
90
|
-
"test": "vitest --run",
|
|
91
|
-
"test:coverage": "vitest --run --coverage",
|
|
92
|
-
"lint": "eslint .",
|
|
93
|
-
"format": "prettier --write .",
|
|
94
|
-
"format:check": "prettier --check ."
|
|
65
|
+
"build": "node scripts/build.ts"
|
|
95
66
|
}
|
|
96
67
|
}
|