vowel 0.1.12 → 0.1.14
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/README.md +17 -122
- package/package.json +8 -1
- package/server.js +0 -8
- package/src/lib/components/DefaultStyles.svelte +54 -2
- package/src/lib/components/Markdown/index.svelte +65 -4
- package/src/lib/utilities/readMarkdownFile.js +28 -1
- package/src/routes/[...path]/+layout.server.js +5 -1
- package/src/routes/[...path]/+page.svelte +21 -3
- package/vite.config.js +9 -0
package/README.md
CHANGED
|
@@ -1,136 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
# Vowel
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- [x] Add RSS
|
|
6
|
-
- [x] Add robots.txt
|
|
7
|
-
- [x] AI
|
|
8
|
-
- [x] Search
|
|
9
|
-
- [x] Image
|
|
10
|
-
- [x] Typing
|
|
11
|
-
- [x] Add sitemap
|
|
12
|
-
- [x] Make taxonomies linkable in frontmatter (if a corresponding folder exists)
|
|
13
|
-
- [x] Add header metadata (meta tags)
|
|
14
|
-
- [x] CSS handling
|
|
15
|
-
- [x] Favicon handling
|
|
16
|
-
- [x] Docs
|
|
17
|
-
- [x] Build action
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
18
5
|
|
|
19
|
-
|
|
6
|
+
The easiest way to code your own website.
|
|
20
7
|
|
|
21
|
-
|
|
22
|
-
- [ ] Create post list element (`#tags/blue`, `@tags/blue`, `~tags/blue`)
|
|
23
|
-
- [x] Better favicon and styles handling
|
|
24
|
-
- [ ] Ignore README files
|
|
25
|
-
- [ ] Add more header metadata
|
|
26
|
-
- [ ] Define folder settings
|
|
27
|
-
- [ ] Title
|
|
28
|
-
- [ ] Breadrumb
|
|
29
|
-
- [x] Define special page properties
|
|
30
|
-
- [x] Title
|
|
31
|
-
- [x] Description
|
|
32
|
-
- [x] Meta image
|
|
33
|
-
- [x] Date
|
|
34
|
-
- [ ] Modified date
|
|
35
|
-
- [ ] Tags
|
|
36
|
-
- [ ] Author/Authors
|
|
37
|
-
- [ ] Make file names kebab-cased for URLs and links
|
|
38
|
-
- [ ] Add hidden routes (`$`)
|
|
39
|
-
- [ ] Image alt text
|
|
40
|
-
- [ ] Code highlighter
|
|
41
|
-
- [x] Deploy action (Vercel)
|
|
42
|
-
- [ ] Add anchor links for headings
|
|
43
|
-
- [ ] Post TOC
|
|
44
|
-
- [ ] GitHub-style notes
|
|
45
|
-
- [ ] Add in-browser search
|
|
46
|
-
- [x] Figure out how to stop components from remounting on every change
|
|
47
|
-
- [ ] Make RSS optional
|
|
48
|
-
- [ ] Pagination
|
|
49
|
-
- [ ] Demote headings global option
|
|
8
|
+
[Try it on StackBlitz](https://stackblitz.com/~/github.com/samlfair/vowel-site?file=home.md).
|
|
50
9
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- [ ] Automatic file creation
|
|
54
|
-
- [ ] Image serving and optimization
|
|
55
|
-
- [ ] GUI
|
|
56
|
-
- [ ] More deploy actions
|
|
57
|
-
- [ ] Optional JSON interactivity (ratings, comments, SubPubHub)
|
|
58
|
-
- [ ] Redirects
|
|
59
|
-
- [ ] Advanced markdown
|
|
60
|
-
- [ ] Highlight
|
|
61
|
-
- [ ] Sanitize
|
|
62
|
-
- [ ] Tables
|
|
63
|
-
- [ ] Strike
|
|
64
|
-
- [ ] Task lists
|
|
65
|
-
- [ ] Footnotes
|
|
66
|
-
- [ ] Mermaid
|
|
67
|
-
- [ ] Math
|
|
68
|
-
- [ ] Wikilinks
|
|
69
|
-
|
|
70
|
-
## Ideas
|
|
71
|
-
|
|
72
|
-
https://github.com/arobase-che/remark-attr
|
|
73
|
-
https://github.com/wataru-chocola/remark-definition-list
|
|
74
|
-
https://github.com/FinnRG/remark-mentions
|
|
75
|
-
https://github.com/remarkjs/remark-toc
|
|
76
|
-
|
|
77
|
-
- Docusaurus
|
|
78
|
-
- MkDocs
|
|
79
|
-
- Coolify
|
|
80
|
-
- NodeGui
|
|
81
|
-
|
|
82
|
-
https://www.nngroup.com/articles/breadcrumb-navigation-useful/
|
|
83
|
-
https://www.nngroup.com/articles/url-as-ui/
|
|
84
|
-
|
|
85
|
-
CSS Frameworks:
|
|
86
|
-
|
|
87
|
-
- Open Props
|
|
88
|
-
- Pico
|
|
89
|
-
- Milligram
|
|
90
|
-
- Spectre
|
|
91
|
-
|
|
92
|
-
## Docs
|
|
93
|
-
|
|
94
|
-
Welcome to Vowel! This project is under development.
|
|
95
|
-
|
|
96
|
-
Vowel is a Really Simple Static Site Generator. Write Markdown files, and Vowel will generate a website for you. Eventually, you will also be able to write a `style.css` file to style your website. When complete, Vowel will generate:
|
|
97
|
-
|
|
98
|
-
- An RSS feed
|
|
99
|
-
- A sitemap
|
|
100
|
-
- Rich link previews (internal and external)
|
|
101
|
-
- Post lists
|
|
102
|
-
- Navigation
|
|
103
|
-
- Optimized images
|
|
104
|
-
- Metadata
|
|
105
|
-
- And more
|
|
106
|
-
|
|
107
|
-
Each file in Vowel is a page. Index pages are called `home.md`.
|
|
10
|
+
Turn a folder of Markdown files into a website by running one command:
|
|
108
11
|
|
|
109
12
|
```
|
|
110
|
-
|
|
111
|
-
├── home.md
|
|
112
|
-
├── settings.md
|
|
113
|
-
├── about.md
|
|
114
|
-
└── posts/
|
|
115
|
-
├── home.md
|
|
116
|
-
├── red-car.md
|
|
117
|
-
├── blue-true.md
|
|
118
|
-
└── green-van.md
|
|
13
|
+
npx -y -p svelte@next -p vowel@latest npx vowel
|
|
119
14
|
```
|
|
120
15
|
|
|
121
|
-
|
|
16
|
+
No installs. No config.
|
|
122
17
|
|
|
123
|
-
|
|
18
|
+
Create a blog, a documentation site, a landing page, a wiki (whatever you want), using just Markdown and CSS.
|
|
124
19
|
|
|
125
|
-
|
|
126
|
-
- `/example-page/home.md`
|
|
127
|
-
Both of the above will generate the `/example-page` URL. You cannot have both files.
|
|
20
|
+
No HTML.
|
|
128
21
|
|
|
129
|
-
|
|
22
|
+
No JavaScript.
|
|
130
23
|
|
|
131
|
-
|
|
132
|
-
- `breadcrumb`: The root breadcrumb
|
|
24
|
+
[Read the docs](https://vowel.cc/docs).
|
|
133
25
|
|
|
134
|
-
|
|
26
|
+
For comments, questions, bugs, and contributions, please reach out to me on Twitter: [@samlfair](https://twitter.com/samlfair).
|
|
135
27
|
|
|
136
|
-
-
|
|
28
|
+
[npm-version-src]: https://img.shields.io/npm/v/vowel/latest.svg
|
|
29
|
+
[npm-version-href]: https://npmjs.com/package/vowel
|
|
30
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/vowel.svg
|
|
31
|
+
[npm-downloads-href]: https://npmjs.com/package/vowel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vowel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"bin": "./bin.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
@@ -31,11 +31,18 @@
|
|
|
31
31
|
"prettier": "^3.0.0",
|
|
32
32
|
"prettier-plugin-svelte": "^3.0.0",
|
|
33
33
|
"remark": "^15.0.1",
|
|
34
|
+
"remark-admonitions": "^1.2.1",
|
|
35
|
+
"remark-directive": "^3.0.0",
|
|
34
36
|
"remark-frontmatter": "^5.0.0",
|
|
37
|
+
"remark-gfm": "^4.0.0",
|
|
35
38
|
"remark-html": "^16.0.1",
|
|
39
|
+
"remark-images": "^4.0.0",
|
|
40
|
+
"remark-parse": "^11.0.0",
|
|
41
|
+
"remark-rehype": "^11.1.0",
|
|
36
42
|
"spectre.css": "^0.5.9",
|
|
37
43
|
"svelte": "^5.0.0-next.121",
|
|
38
44
|
"typescript": "^5.0.0",
|
|
45
|
+
"unified": "^11.0.4",
|
|
39
46
|
"url-metadata": "^3.4.9",
|
|
40
47
|
"vite": "^5.0.12",
|
|
41
48
|
"xml": "^1.0.1"
|
package/server.js
CHANGED
|
@@ -46,21 +46,13 @@ async function buildProject() {
|
|
|
46
46
|
let projectData = null;
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
|
-
console.log({ config });
|
|
50
49
|
if (existsSync(projectJsonPath)) {
|
|
51
|
-
console.log('inside');
|
|
52
50
|
const data = await readFile(projectJsonPath, 'utf-8');
|
|
53
|
-
console.log({ data });
|
|
54
51
|
projectData = JSON.parse(data);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
console.log({ projectData });
|
|
58
|
-
console.log('Building...');
|
|
59
|
-
|
|
60
54
|
await build(config);
|
|
61
55
|
|
|
62
|
-
console.log('Build completed.');
|
|
63
|
-
|
|
64
56
|
if (projectData !== null) {
|
|
65
57
|
await mkdir(vercelDirPath, { recursive: true });
|
|
66
58
|
await writeFile(projectJsonPath, JSON.stringify(projectData, null, 2), 'utf-8');
|
|
@@ -132,6 +132,8 @@
|
|
|
132
132
|
img {
|
|
133
133
|
border-style: none;
|
|
134
134
|
height: auto;
|
|
135
|
+
border-radius: 5px;
|
|
136
|
+
overflow: hidden;
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
/* Layout */
|
|
@@ -352,7 +354,9 @@
|
|
|
352
354
|
padding-right: 0;
|
|
353
355
|
}
|
|
354
356
|
|
|
355
|
-
:where(pre, blockquote, dl, figure, table, p, ul, ol, form, article, section):not(
|
|
357
|
+
:where(pre, blockquote, dl, figure, table, p, ul, ol, form, article, section, aside):not(
|
|
358
|
+
:last-child
|
|
359
|
+
) {
|
|
356
360
|
margin-bottom: 2.5rem;
|
|
357
361
|
}
|
|
358
362
|
|
|
@@ -448,7 +452,7 @@
|
|
|
448
452
|
/* Sidebar */
|
|
449
453
|
|
|
450
454
|
.sidebar {
|
|
451
|
-
margin: auto;
|
|
455
|
+
margin-inline: auto;
|
|
452
456
|
}
|
|
453
457
|
|
|
454
458
|
/* Footer */
|
|
@@ -513,5 +517,53 @@
|
|
|
513
517
|
article.item dl.icon {
|
|
514
518
|
order: -1;
|
|
515
519
|
}
|
|
520
|
+
|
|
521
|
+
aside.note {
|
|
522
|
+
&.note {
|
|
523
|
+
--icon: 'ℹ️';
|
|
524
|
+
--rgb: 71, 139, 230;
|
|
525
|
+
}
|
|
526
|
+
&.tip {
|
|
527
|
+
--icon: '💡';
|
|
528
|
+
--rgb: 87, 171, 90;
|
|
529
|
+
}
|
|
530
|
+
&.important {
|
|
531
|
+
--icon: '💬';
|
|
532
|
+
--rgb: 152, 110, 226;
|
|
533
|
+
}
|
|
534
|
+
&.warning {
|
|
535
|
+
--icon: '⚠️';
|
|
536
|
+
--rgb: 198, 144, 38;
|
|
537
|
+
}
|
|
538
|
+
&.caution {
|
|
539
|
+
--icon: '⛔️';
|
|
540
|
+
--rgb: 229, 83, 75;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
border-left: 3px solid rgb(var(--rgb));
|
|
544
|
+
padding: 1.5rem 2rem;
|
|
545
|
+
background: rgba(var(--rgb), 0.04);
|
|
546
|
+
|
|
547
|
+
h2 {
|
|
548
|
+
margin: 0 0 0.5em 0;
|
|
549
|
+
font-size: 1.1em;
|
|
550
|
+
color: rgb(var(--rgb));
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
h2:before {
|
|
554
|
+
font-size: 0.8em;
|
|
555
|
+
margin-right: 0.7rem;
|
|
556
|
+
opacity: 0.9;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
h2:before {
|
|
560
|
+
content: var(--icon);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
li.checked,
|
|
565
|
+
li.unchecked {
|
|
566
|
+
padding-left: 0.8rem;
|
|
567
|
+
}
|
|
516
568
|
}
|
|
517
569
|
</style>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
let { props } = $props();
|
|
13
13
|
|
|
14
|
-
let { ast, level, website, format } = $derived(props);
|
|
14
|
+
let { ast, level, website, format, identifier } = $derived(props);
|
|
15
15
|
|
|
16
16
|
function getElement(node) {
|
|
17
17
|
if (node.type === 'heading') {
|
|
@@ -23,16 +23,32 @@
|
|
|
23
23
|
paragraph: 'p',
|
|
24
24
|
strong: 'strong',
|
|
25
25
|
list: node.ordered ? 'ol' : 'ul',
|
|
26
|
-
listItem: 'li',
|
|
26
|
+
// listItem: 'li',
|
|
27
27
|
blockquote: 'blockquote',
|
|
28
28
|
inlineCode: 'code',
|
|
29
29
|
code: 'pre',
|
|
30
30
|
figure: 'figure',
|
|
31
|
-
figcaption: 'figcaption'
|
|
31
|
+
figcaption: 'figcaption',
|
|
32
|
+
delete: 's',
|
|
33
|
+
table: 'table',
|
|
34
|
+
tableRow: 'tr',
|
|
35
|
+
tableCell: 'td'
|
|
32
36
|
};
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
// Handle list item separately
|
|
39
|
+
// Handle `pre` properly
|
|
40
|
+
// Handle `footnoteDefinition` and `footnoteReference`
|
|
41
|
+
|
|
42
|
+
if (elements[node.type]) return elements[node.type];
|
|
35
43
|
}
|
|
44
|
+
|
|
45
|
+
const noteTypes = {
|
|
46
|
+
tip: 'Tip',
|
|
47
|
+
note: 'Note',
|
|
48
|
+
important: 'Important',
|
|
49
|
+
warning: 'Warning',
|
|
50
|
+
caution: 'Caution'
|
|
51
|
+
};
|
|
36
52
|
</script>
|
|
37
53
|
|
|
38
54
|
{#if ast}
|
|
@@ -70,9 +86,54 @@
|
|
|
70
86
|
<Image {node} />
|
|
71
87
|
{:else if node.type === 'url'}
|
|
72
88
|
<LinkPreview url={node.value} metadata={node.metadata} {format} />
|
|
89
|
+
{:else if node.type === 'listItem'}
|
|
90
|
+
{@const isChecklistItem = node.hasOwnProperty('checked')}
|
|
91
|
+
{#if isChecklistItem}
|
|
92
|
+
<li
|
|
93
|
+
class={`checklist-item ${node.checked ? 'checked' : 'unchecked'}`}
|
|
94
|
+
style:list-style-type={`"${node.checked ? '☑' : '☐'}"`}
|
|
95
|
+
>
|
|
96
|
+
<svelte:self props={{ ast: node.children, level, format }} />
|
|
97
|
+
</li>
|
|
98
|
+
{:else}
|
|
99
|
+
<li>
|
|
100
|
+
<svelte:self props={{ ast: node.children, level, format }} />
|
|
101
|
+
</li>
|
|
102
|
+
{/if}
|
|
103
|
+
{:else if node.type === 'footnoteReference'}
|
|
104
|
+
<sup
|
|
105
|
+
><a
|
|
106
|
+
href={`#footnote-definition-${node.identifier}`}
|
|
107
|
+
id={`footnote-${node.identifier}`}
|
|
108
|
+
aria-describedby="footnotes">{node.label}</a
|
|
109
|
+
></sup
|
|
110
|
+
>
|
|
111
|
+
{:else if node.type === 'footnotes'}
|
|
112
|
+
<section id="footnotes">
|
|
113
|
+
<h2>Footnotes</h2>
|
|
114
|
+
<ol>
|
|
115
|
+
{#each node.children as footnote}
|
|
116
|
+
<li id={`footnote-definition-${footnote.identifier}`}>
|
|
117
|
+
<svelte:self
|
|
118
|
+
props={{ ast: footnote.children, level, format, identifier: footnote.identifier }}
|
|
119
|
+
/>
|
|
120
|
+
</li>
|
|
121
|
+
{/each}
|
|
122
|
+
</ol>
|
|
123
|
+
</section>
|
|
124
|
+
{:else if node.type === 'containerDirective' && noteTypes[node.name]}
|
|
125
|
+
<aside class={`note ${node.name}`}>
|
|
126
|
+
<h2>
|
|
127
|
+
{noteTypes[node.name]}
|
|
128
|
+
</h2>
|
|
129
|
+
<svelte:self props={{ ast: node.children, level, format }}></svelte:self>
|
|
130
|
+
</aside>
|
|
73
131
|
{:else if node.children}
|
|
74
132
|
<svelte:element this={getElement(node)}>
|
|
75
133
|
<svelte:self props={{ ast: node.children, level, format }} />
|
|
134
|
+
{#if identifier}
|
|
135
|
+
<a href={`#footnote-${identifier}`} aria-label="Back to content">↩</a>
|
|
136
|
+
{/if}
|
|
76
137
|
</svelte:element>
|
|
77
138
|
{:else if node.type === 'text'}
|
|
78
139
|
<Text {node} />
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import { remark } from 'remark';
|
|
3
3
|
import remarkFrontmatter from 'remark-frontmatter';
|
|
4
|
+
import remarkDirective from 'remark-directive';
|
|
4
5
|
import remarkHTML from 'remark-html';
|
|
6
|
+
import remarkGFM from 'remark-gfm';
|
|
5
7
|
import yaml from 'js-yaml';
|
|
6
8
|
import { toString } from 'mdast-util-to-string';
|
|
7
9
|
import path from 'path';
|
|
@@ -102,7 +104,32 @@ export default async function readMarkdownFile(filePath, cache) {
|
|
|
102
104
|
const parsedMarkdown = markdownParser.parse(fileContent);
|
|
103
105
|
const frontmatterNode = parsedMarkdown.children.find((node) => node.type === 'yaml');
|
|
104
106
|
const frontmatter = frontmatterNode?.type === 'yaml' ? parseFrontmatter(frontmatterNode) : {};
|
|
105
|
-
const ast = remark()
|
|
107
|
+
const ast = remark()
|
|
108
|
+
.use(remarkDirective)
|
|
109
|
+
.use(remarkFrontmatter)
|
|
110
|
+
.use(remarkGFM)
|
|
111
|
+
.parse(fileContent);
|
|
112
|
+
|
|
113
|
+
const footnotes = [];
|
|
114
|
+
|
|
115
|
+
for (let i = 0; i < ast.children.length; i++) {
|
|
116
|
+
if (ast.children[i].type === 'footnoteDefinition') {
|
|
117
|
+
footnotes.push(ast.children[i]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (footnotes.length) {
|
|
122
|
+
ast.children.push({
|
|
123
|
+
type: 'footnotes',
|
|
124
|
+
children: footnotes
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ast.children.sort((a, b) => {
|
|
129
|
+
// if (a.type !== 'footnoteDefinition' && b.type === 'footnoteDefinition') return -1;
|
|
130
|
+
// return 0;
|
|
131
|
+
// });
|
|
132
|
+
|
|
106
133
|
const filteredAST = ast.children.filter((child) => child.type !== 'yaml');
|
|
107
134
|
|
|
108
135
|
const imputedTitle = imputeTitleFromAST(filteredAST);
|
|
@@ -3,6 +3,10 @@ import { access } from 'fs/promises';
|
|
|
3
3
|
import { constants } from 'fs';
|
|
4
4
|
import { normalize, join, basename } from 'path';
|
|
5
5
|
import { dev } from '$app/environment';
|
|
6
|
+
import mri from 'mri';
|
|
7
|
+
|
|
8
|
+
const args = mri(process.argv);
|
|
9
|
+
const isBuild = args._.includes('build');
|
|
6
10
|
|
|
7
11
|
export const prerender = true;
|
|
8
12
|
export const csr = dev;
|
|
@@ -24,7 +28,7 @@ async function checkFileExists(filePath, homeDir) {
|
|
|
24
28
|
export async function load() {
|
|
25
29
|
// const startLoad = performance.now();
|
|
26
30
|
const now = Date.now();
|
|
27
|
-
const contentCacheDuration = 60000; // Cache for 1
|
|
31
|
+
const contentCacheDuration = isBuild ? 60000 : 0; // Cache for 1 second
|
|
28
32
|
const initialURLCache = await loadCache($home[0]);
|
|
29
33
|
|
|
30
34
|
const cssExists = await checkFileExists(normalize('/assets/styles.css'), $home[0]);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { error } from '@sveltejs/kit';
|
|
7
7
|
import { getFolder, getFolderLabel } from '../../lib/utilities';
|
|
8
8
|
import { page as pageStore } from '$app/stores';
|
|
9
|
-
import
|
|
9
|
+
import { goto, invalidate, invalidateAll } from '$app/navigation';
|
|
10
10
|
|
|
11
11
|
let { data } = $props();
|
|
12
12
|
|
|
@@ -56,16 +56,34 @@
|
|
|
56
56
|
|
|
57
57
|
const favicon = getFavicon();
|
|
58
58
|
|
|
59
|
+
let key = $state(Date.now());
|
|
60
|
+
|
|
59
61
|
$effect(() => {
|
|
60
62
|
// Update website on file change
|
|
61
63
|
if (import.meta.hot) {
|
|
62
64
|
import.meta.hot.on('vowel:update', ({ path, file }) => {
|
|
63
65
|
let updatedPage = getPage(website, path);
|
|
66
|
+
if (!updatedPage) {
|
|
67
|
+
invalidateAll().then(() => {
|
|
68
|
+
window.location.reload();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
64
71
|
|
|
65
72
|
for (const key in file) {
|
|
73
|
+
if (!updatedPage[key]) updatedPage[key] = {};
|
|
66
74
|
updatedPage[key] = file[key];
|
|
67
75
|
}
|
|
68
76
|
});
|
|
77
|
+
import.meta.hot.on('vowel:refresh', () => {
|
|
78
|
+
console.log('Refresh');
|
|
79
|
+
invalidateAll().then(() => {
|
|
80
|
+
console.log(website);
|
|
81
|
+
// location.reload();
|
|
82
|
+
// goto(window.location.href);
|
|
83
|
+
// key = Date.now();
|
|
84
|
+
window.location.reload();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
69
87
|
}
|
|
70
88
|
});
|
|
71
89
|
</script>
|
|
@@ -106,7 +124,7 @@
|
|
|
106
124
|
{#if website._.slogan}
|
|
107
125
|
<p class="slogan">{website._.slogan}</p>
|
|
108
126
|
{/if}
|
|
109
|
-
<Nav folder={
|
|
127
|
+
<Nav folder={website} segments={data.path.split('/')} />
|
|
110
128
|
<nav class="breadcrumbs" aria-label="Breadcrumb">
|
|
111
129
|
<Breadcrumbs level={0} />
|
|
112
130
|
</nav>
|
|
@@ -115,7 +133,7 @@
|
|
|
115
133
|
<Page level={0} {page} {website} path={data.path} />
|
|
116
134
|
</main>
|
|
117
135
|
<nav class="sidebar">
|
|
118
|
-
<Sitemap section={
|
|
136
|
+
<Sitemap section={website} segments={data.path.split('/')} root />
|
|
119
137
|
</nav>
|
|
120
138
|
<footer>
|
|
121
139
|
© {website._.author ? website._.author + ' ' : ''}
|
package/vite.config.js
CHANGED
|
@@ -23,7 +23,16 @@ export default defineConfig({
|
|
|
23
23
|
name: 'markdown:watch',
|
|
24
24
|
configureServer(server) {
|
|
25
25
|
server.watcher.add(homeDir);
|
|
26
|
+
server.watcher.on('add', () => {
|
|
27
|
+
console.log('Add');
|
|
28
|
+
server.ws.send('vowel:refresh');
|
|
29
|
+
});
|
|
30
|
+
server.watcher.on('unlink', () => {
|
|
31
|
+
console.log('unlink');
|
|
32
|
+
server.ws.send('vowel:refresh');
|
|
33
|
+
});
|
|
26
34
|
server.watcher.on('change', async (homePath, stats) => {
|
|
35
|
+
console.log('change');
|
|
27
36
|
if (homePath.endsWith('.md')) {
|
|
28
37
|
// Remove `.md`
|
|
29
38
|
const cache = await loadCache(homeDir);
|