vowel 0.1.13 → 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 CHANGED
@@ -1,136 +1,31 @@
1
- ## MVP
1
+ # Vowel
2
2
 
3
- - [x] Add all element types supported in Obsidian to markdown
4
- - [x] Add rich link previews
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
- ## V2
6
+ The easiest way to code your own website.
20
7
 
21
- - [x] Fallback homepages
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
- ## Wish list
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
- In the above project, `/home.md` is the website homepage. `about.md` is `/about`, `/posts/home.md` is the blog homepage, `/blog`, and `/posts/red-car.md` is a blog post, `/posts/red-car`.
16
+ No installs. No config.
122
17
 
123
- Every folder must have an index page. That means that there are two ways to represent a page:
18
+ Create a blog, a documentation site, a landing page, a wiki (whatever you want), using just Markdown and CSS.
124
19
 
125
- - `/example-page.md`
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
- At the root of a project, a `settings.md` file defines global configurations, like your site title. It can have the following properties:
22
+ No JavaScript.
130
23
 
131
- - `title`: Website title
132
- - `breadcrumb`: The root breadcrumb
24
+ [Read the docs](https://vowel.cc/docs).
133
25
 
134
- Each folder can also have a `settings.md` file, with the following properties:
26
+ For comments, questions, bugs, and contributions, please reach out to me on Twitter: [@samlfair](https://twitter.com/samlfair).
135
27
 
136
- - `breadcrumb`: The breadcrumb for the folder
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.13",
3
+ "version": "0.1.14",
4
4
  "bin": "./bin.js",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
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');
@@ -452,7 +452,7 @@
452
452
  /* Sidebar */
453
453
 
454
454
  .sidebar {
455
- margin: auto;
455
+ margin-inline: auto;
456
456
  }
457
457
 
458
458
  /* Footer */
@@ -13,10 +13,6 @@
13
13
 
14
14
  let { ast, level, website, format, identifier } = $derived(props);
15
15
 
16
- if (identifier) {
17
- console.log(identifier);
18
- }
19
-
20
16
  function getElement(node) {
21
17
  if (node.type === 'heading') {
22
18
  return ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'div'][node.depth - 1];
@@ -44,7 +40,6 @@
44
40
  // Handle `footnoteDefinition` and `footnoteReference`
45
41
 
46
42
  if (elements[node.type]) return elements[node.type];
47
- console.log(node);
48
43
  }
49
44
 
50
45
  const noteTypes = {
@@ -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 minute
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 ConditionalWrapper from '../../lib/components/ConditionalWrapper.svelte';
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={data.website} segments={data.path.split('/')} />
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={data.website} segments={data.path.split('/')} root />
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);