vowel 0.1.23 → 0.1.24
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/package.json
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
--border-color: hsl(0, 0%, 73%);
|
|
18
18
|
--main-background: hsl(0, 0%, 100%);
|
|
19
19
|
--code-background: hsl(0, 0%, 95%);
|
|
20
|
-
--soft-background: hsl(0, 0%, 95%);
|
|
20
|
+
/* --soft-background: hsl(0, 0%, 95%); */
|
|
21
|
+
--soft-background: #00000005;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
@media (prefers-color-scheme: dark) {
|
|
@@ -28,7 +29,8 @@
|
|
|
28
29
|
--border-color: hsl(0, 0%, 27%);
|
|
29
30
|
--main-background: hsl(0, 0%, 12%);
|
|
30
31
|
--code-background: hsl(0, 0%, 5%);
|
|
31
|
-
--soft-background: hsl(0, 0%, 14%);
|
|
32
|
+
/* --soft-background: hsl(0, 0%, 14%); */
|
|
33
|
+
--soft-background: #ffffff07;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -269,10 +271,6 @@
|
|
|
269
271
|
order: -1;
|
|
270
272
|
}
|
|
271
273
|
|
|
272
|
-
article.thumbnail dl.link {
|
|
273
|
-
display: none;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
274
|
aside.note {
|
|
277
275
|
&.note {
|
|
278
276
|
--icon: 'ℹ️';
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
let { page, content = true, link, level = 0, website = {}, format = 'html' } = $props();
|
|
8
8
|
let { ast, title, date, image, imputedProperties } = $derived(page || {});
|
|
9
9
|
|
|
10
|
+
let headerImage = $derived(image?.output || imputedProperties.image)
|
|
11
|
+
|
|
10
12
|
const dateObject = date?.type === 'date' && new Date(date.output);
|
|
11
13
|
// TODO: Add conditional logic for format = 'xml'
|
|
12
14
|
|
|
@@ -14,13 +16,13 @@
|
|
|
14
16
|
</script>
|
|
15
17
|
|
|
16
18
|
<!-- Image -->
|
|
17
|
-
{#if
|
|
19
|
+
{#if headerImage}
|
|
18
20
|
{#if link}
|
|
19
|
-
<a href={page.url}>
|
|
20
|
-
<Image node={{ url:
|
|
21
|
+
<a href={page.url} class="image">
|
|
22
|
+
<Image node={{ url: headerImage, alt: '' }} />
|
|
21
23
|
</a>
|
|
22
24
|
{:else}
|
|
23
|
-
<Image node={{ url:
|
|
25
|
+
<Image node={{ url: headerImage, alt: '' }} />
|
|
24
26
|
{/if}
|
|
25
27
|
{/if}
|
|
26
28
|
|
|
@@ -45,6 +45,21 @@ function deduceDescriptionFromAST(ast) {
|
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function deduceImageFromAST(ast) {
|
|
49
|
+
for (let i = 0; i < ast?.length; i++) {
|
|
50
|
+
const node = ast?.[i]
|
|
51
|
+
if (node.type === 'figure') {
|
|
52
|
+
for(let i = 0; i < node.children.length; i++) {
|
|
53
|
+
const child = node.children[i]
|
|
54
|
+
if(child.type === "image") {
|
|
55
|
+
return child.url
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
function demoteHeadings(ast, start) {
|
|
49
64
|
for (let i = start; i < ast.length; i++) {
|
|
50
65
|
const node = ast[i];
|
|
@@ -144,6 +159,8 @@ export default async function readMarkdownFile(filePath, cache) {
|
|
|
144
159
|
|
|
145
160
|
if (!frontmatter.title && imputedTitle) frontmatter.title = imputedTitle;
|
|
146
161
|
|
|
162
|
+
|
|
163
|
+
|
|
147
164
|
const imputedProperties = {
|
|
148
165
|
description: deduceDescriptionFromAST(filteredAST),
|
|
149
166
|
title: imputedTitle,
|
|
@@ -158,5 +175,11 @@ export default async function readMarkdownFile(filePath, cache) {
|
|
|
158
175
|
|
|
159
176
|
await Promise.all(promises);
|
|
160
177
|
|
|
178
|
+
const imputedImage = deduceImageFromAST(filteredAST)
|
|
179
|
+
|
|
180
|
+
if(imputedImage) {
|
|
181
|
+
imputedProperties.image = imputedImage
|
|
182
|
+
}
|
|
183
|
+
|
|
161
184
|
return { frontmatter, ast: filteredAST, imputedProperties };
|
|
162
185
|
}
|