@kamod-ch/preactpress 1.0.2 → 2.0.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/dist/client/app.d.ts.map +1 -1
- package/dist/client/app.js +54 -7
- package/dist/client/app.js.map +1 -1
- package/dist/client/loadPage.d.ts +1 -0
- package/dist/client/loadPage.d.ts.map +1 -1
- package/dist/client/loadPage.js +3 -0
- package/dist/client/loadPage.js.map +1 -1
- package/dist/client/mermaid.d.ts +2 -0
- package/dist/client/mermaid.d.ts.map +1 -0
- package/dist/client/mermaid.js +68 -0
- package/dist/client/mermaid.js.map +1 -0
- package/dist/client/theme-default/Layout.d.ts.map +1 -1
- package/dist/client/theme-default/Layout.js +43 -0
- package/dist/client/theme-default/Layout.js.map +1 -1
- package/dist/node/markdown.d.ts.map +1 -1
- package/dist/node/markdown.js +24 -6
- package/dist/node/markdown.js.map +1 -1
- package/dist/shared/scrollRestoration.d.ts +11 -0
- package/dist/shared/scrollRestoration.d.ts.map +1 -0
- package/dist/shared/scrollRestoration.js +88 -0
- package/dist/shared/scrollRestoration.js.map +1 -0
- package/dist/shared/search.d.ts.map +1 -1
- package/dist/shared/search.js +4 -1
- package/dist/shared/search.js.map +1 -1
- package/package.json +2 -1
- package/src/client/app.tsx +59 -7
- package/src/client/loadPage.ts +4 -0
- package/src/client/mermaid.ts +74 -0
- package/src/client/theme-default/Layout.tsx +43 -0
- package/src/client/theme-default/styles.css +181 -5
- package/src/shared/scrollRestoration.ts +101 -0
- package/src/shared/search.ts +5 -1
- package/templates/docs/.preactpress/config.ts +5 -0
- package/templates/docs/examples/cloudflare-pages.md +117 -0
- package/templates/docs/examples/custom-theme.md +266 -0
- package/templates/docs/examples/mermaid.md +53 -0
- package/templates/docs/examples/preact-signals.md +102 -0
- package/templates/docs/examples/rss.md +104 -0
- package/templates/docs/guide/custom-themes.md +1 -1
- package/templates/docs/guide/deploy.md +2 -0
- package/templates/docs/guide/markdown-and-mdx.md +1 -1
- package/templates/docs/markdown-examples.md +10 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: RSS / Atom feed
|
|
3
|
+
description: Generate a static feed.xml for blogs, changelogs, and magazine-style sites.
|
|
4
|
+
tags:
|
|
5
|
+
- examples
|
|
6
|
+
- deploy
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
PreactPress can generate a static `feed.xml` during production builds. The feed uses the Atom XML format and is suitable for RSS readers.
|
|
10
|
+
|
|
11
|
+
## Enable the feed
|
|
12
|
+
|
|
13
|
+
Set `site.url` and enable `build.feed` in `.preactpress/config.ts`:
|
|
14
|
+
|
|
15
|
+
```ts [.preactpress/config.ts]
|
|
16
|
+
import { defineConfig } from "@kamod-ch/preactpress/config";
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
site: {
|
|
20
|
+
title: "Acme Blog",
|
|
21
|
+
description: "Product updates and engineering notes",
|
|
22
|
+
url: "https://example.com",
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
build: {
|
|
26
|
+
feed: { limit: 20 },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
After running a production build, PreactPress writes:
|
|
32
|
+
|
|
33
|
+
```txt
|
|
34
|
+
dist/feed.xml
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Add page metadata
|
|
38
|
+
|
|
39
|
+
Feed entries use each page's title, description, route, and `lastUpdated` value.
|
|
40
|
+
|
|
41
|
+
```md [posts/launch.md]
|
|
42
|
+
---
|
|
43
|
+
title: Launch notes
|
|
44
|
+
description: What shipped in our first public release.
|
|
45
|
+
lastUpdated: 2026-07-01T10:00:00.000Z
|
|
46
|
+
tags:
|
|
47
|
+
- changelog
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
We shipped the first public version today.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Build and inspect
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then open or publish:
|
|
60
|
+
|
|
61
|
+
```txt
|
|
62
|
+
https://example.com/feed.xml
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Link the feed from your HTML head
|
|
66
|
+
|
|
67
|
+
You can expose the feed to browsers and feed readers with `transformHead`:
|
|
68
|
+
|
|
69
|
+
```ts [.preactpress/config.ts]
|
|
70
|
+
import { defineConfig } from "@kamod-ch/preactpress/config";
|
|
71
|
+
|
|
72
|
+
export default defineConfig({
|
|
73
|
+
site: {
|
|
74
|
+
title: "Acme Blog",
|
|
75
|
+
description: "Product updates and engineering notes",
|
|
76
|
+
url: "https://example.com",
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
build: {
|
|
80
|
+
feed: { limit: 20 },
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
transformHead() {
|
|
84
|
+
return [
|
|
85
|
+
[
|
|
86
|
+
"link",
|
|
87
|
+
{
|
|
88
|
+
rel: "alternate",
|
|
89
|
+
type: "application/atom+xml",
|
|
90
|
+
title: "Acme Blog feed",
|
|
91
|
+
href: "/feed.xml",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
];
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
|
|
101
|
+
- Feed generation requires `site.url`.
|
|
102
|
+
- Draft pages are excluded from production output and therefore from the feed.
|
|
103
|
+
- `build.feed: true` includes all pages.
|
|
104
|
+
- `build.feed: { limit: 20 }` keeps only the newest entries.
|
|
@@ -36,4 +36,4 @@ export default Layout;
|
|
|
36
36
|
|
|
37
37
|
Theme authors are responsible for navigation, responsive behavior, focus management, search UI, and rendering Markdown versus MDX pages. Helpers for routes, page head data, tags, slugs, and theme state are exported from `@kamod-ch/preactpress/client` and `@kamod-ch/preactpress/shared`.
|
|
38
38
|
|
|
39
|
-
The `magazine` and `hono` init templates are complete custom-theme examples.
|
|
39
|
+
See the [custom theme example](/examples/custom-theme) for a copy-pasteable minimal theme. The `magazine` and `hono` init templates are complete custom-theme examples.
|
|
@@ -97,6 +97,8 @@ For most static hosts, use these settings:
|
|
|
97
97
|
| Cloudflare Pages | `pnpm run build` | `dist` |
|
|
98
98
|
| Render Static Site | `pnpm run build` | `dist` |
|
|
99
99
|
|
|
100
|
+
See the [Cloudflare Pages deployment guide](/examples/cloudflare-pages) for dashboard settings, environment variables, Wrangler deployment, and custom domain notes.
|
|
101
|
+
|
|
100
102
|
Install command:
|
|
101
103
|
|
|
102
104
|
```bash
|
|
@@ -7,7 +7,7 @@ Use `.md` for content that does not need browser-side components. Use `.mdx` whe
|
|
|
7
7
|
|
|
8
8
|
## Markdown
|
|
9
9
|
|
|
10
|
-
Markdown pages support frontmatter, heading anchors, syntax highlighting, tables, containers, GFM alerts, code groups, file includes, snippet imports, emoji, optional MathJax, and `[[toc]]`.
|
|
10
|
+
Markdown pages support frontmatter, heading anchors, syntax highlighting, Mermaid diagrams, tables, containers, GFM alerts, code groups, file includes, snippet imports, emoji, optional MathJax, and `[[toc]]`.
|
|
11
11
|
|
|
12
12
|
```md
|
|
13
13
|
---
|
|
@@ -23,6 +23,16 @@ export function greet(name: string) {
|
|
|
23
23
|
|
|
24
24
|
Inline code like `themeConfig.outline` uses the same theme tokens as code blocks.
|
|
25
25
|
|
|
26
|
+
## Mermaid diagrams
|
|
27
|
+
|
|
28
|
+
Use a `mermaid` fenced code block to render diagrams in Markdown and MDX pages:
|
|
29
|
+
|
|
30
|
+
```mermaid
|
|
31
|
+
graph TD
|
|
32
|
+
A[Markdown] --> B[PreactPress]
|
|
33
|
+
B --> C[Static HTML]
|
|
34
|
+
```
|
|
35
|
+
|
|
26
36
|
## Snippet import
|
|
27
37
|
|
|
28
38
|
Reuse source files instead of duplicating code:
|