@binarynoir/vitepress-blog 0.2.0 → 0.4.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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BlogAuthor, a as BlogFeedConfig, b as BlogIndexConfig, c as BlogLabels, d as BlogLayout, e as BlogOptions, f as BlogPostData, g as BlogScope, D as DEFAULT_LABELS, h as blogMarkdown } from './plugin-BlfpqyX4.cjs';
1
+ export { B as BlogAnnouncementData, a as BlogAnnouncementItem, b as BlogAuthor, c as BlogFeedConfig, d as BlogGroupBy, e as BlogIndexConfig, f as BlogLabels, g as BlogLayout, h as BlogOptions, i as BlogPostData, j as BlogScope, D as DEFAULT_LABELS, k as blogMarkdown } from './plugin-DUTUA_t4.cjs';
2
2
  import 'markdown-it';
3
3
 
4
4
  /** Marker a blog page can use to say where its list of posts goes. Without it the list is appended. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BlogAuthor, a as BlogFeedConfig, b as BlogIndexConfig, c as BlogLabels, d as BlogLayout, e as BlogOptions, f as BlogPostData, g as BlogScope, D as DEFAULT_LABELS, h as blogMarkdown } from './plugin-BlfpqyX4.js';
1
+ export { B as BlogAnnouncementData, a as BlogAnnouncementItem, b as BlogAuthor, c as BlogFeedConfig, d as BlogGroupBy, e as BlogIndexConfig, f as BlogLabels, g as BlogLayout, h as BlogOptions, i as BlogPostData, j as BlogScope, D as DEFAULT_LABELS, k as blogMarkdown } from './plugin-DUTUA_t4.js';
2
2
  import 'markdown-it';
3
3
 
4
4
  /** Marker a blog page can use to say where its list of posts goes. Without it the list is appended. */
package/dist/index.js CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  POST_FRONTMATTER_KEY,
6
6
  WIDGET_NAME,
7
7
  blogMarkdown
8
- } from "./chunk-PWNWSYI4.js";
8
+ } from "./chunk-ZM5FOUT4.js";
9
+ import "./chunk-42Z6H7IN.js";
9
10
  export {
10
11
  BLOG_POSTS_PLACEHOLDER,
11
12
  DEFAULT_LABELS,
@@ -64,10 +64,12 @@ interface BlogOptions {
64
64
  */
65
65
  pageSize?: number;
66
66
  /**
67
- * Most sticky posts pinned to the top of a blog page, for those that don't
68
- * set `stickyLimit`. Extra sticky posts take their place by date. `0` pins
69
- * them all. Default: `0`.
67
+ * Most `pinned: true` posts kept at the top of a blog page, for those that
68
+ * don't set `pinLimit`. Extra pinned posts take their place by date. `0`
69
+ * pins them all. Default: `0`.
70
70
  */
71
+ pinLimit?: number;
72
+ /** @deprecated Renamed `pinLimit`; still read when `pinLimit` isn't set. */
71
73
  stickyLimit?: number;
72
74
  /**
73
75
  * Show a "Subscribe" RSS link on blog pages and `::: blog-posts` blocks,
@@ -75,7 +77,7 @@ interface BlogOptions {
75
77
  * on a site with a site URL (without one, no feeds are written). Default: `true`.
76
78
  */
77
79
  rssLink?: boolean;
78
- /** Words the plugin writes on pages, for translating. `{n}`, `{blog}` and `{tag}` are filled in. */
80
+ /** Words the plugin writes on pages, for translating. `{n}`, `{blog}` and `{filter}` are filled in. */
79
81
  labels?: Partial<BlogLabels>;
80
82
  }
81
83
  interface BlogLabels {
@@ -94,19 +96,41 @@ interface BlogLabels {
94
96
  /** The link back to a post's blog: "All posts in {blog}". */
95
97
  allPosts: string;
96
98
  draft: string;
97
- /** Badge on a sticky post. */
98
- sticky: string;
99
+ /** Badge on a pinned post. */
100
+ pinned: string;
101
+ /** Badge on an announcement, and the accessible name of the announcement banner. */
102
+ announcement: string;
103
+ /** A blog page's announcements filter (`?announcements`), in the active filters. */
104
+ announcements: string;
105
+ /** Tooltip of the banner's count badge: "{n} announcements". */
106
+ announcementCount: string;
107
+ /** Accessible name of the banner's close button. */
108
+ dismiss: string;
99
109
  noPosts: string;
100
- /** Year heading for posts without a date, when a blog groups by year. */
110
+ /** Group heading for posts without a date, when a blog groups by year or month. */
101
111
  undated: string;
102
- /** Label of a blog page's keyword list. */
112
+ /** Accessible name of the browse panel above a blog page's posts. */
113
+ browse: string;
114
+ /** Label of the browse panel's category row. */
115
+ categories: string;
116
+ /** Label of the browse panel's keyword row. */
103
117
  tags: string;
104
- /** Above a list filtered by keyword: "Posts tagged {tag}". */
105
- tagged: string;
106
- /** Link that clears the keyword filter. */
118
+ /** Label of the browse panel's year row. */
119
+ archive: string;
120
+ /** Names a category filter among the active filters: "Category". */
121
+ category: string;
122
+ /** Names a keyword filter among the active filters: "Keyword". */
123
+ tag: string;
124
+ /** How many posts the active filters match: "{n} posts". */
125
+ postCount: string;
126
+ /** The same, for one post: "{n} post". */
127
+ postCountOne: string;
128
+ /** When no post matches the active filters. */
129
+ noMatches: string;
130
+ /** Accessible name of an active filter's remove link: "Remove filter: {filter}". */
131
+ removeFilter: string;
132
+ /** Link that clears every filter. */
107
133
  showAll: string;
108
- /** When no post has the keyword: "No posts tagged {tag}." */
109
- noTagged: string;
110
134
  previous: string;
111
135
  next: string;
112
136
  /** Accessible name of the page links. */
@@ -119,6 +143,8 @@ interface BlogLabels {
119
143
  declare const DEFAULT_LABELS: BlogLabels;
120
144
  type BlogScope = 'site' | 'section';
121
145
  type BlogLayout = 'list' | 'grid' | 'compact';
146
+ /** How a blog page groups its posts under headings: by year, by month, or not at all (`''`). */
147
+ type BlogGroupBy = 'year' | 'month' | '';
122
148
  interface BlogFeedConfig {
123
149
  title?: string;
124
150
  description?: string;
@@ -134,19 +160,27 @@ interface BlogIndexConfig {
134
160
  folders: string[];
135
161
  /** Only list posts with at least one of these tags. */
136
162
  tags: string[];
163
+ /** Only list posts in one of these categories. */
164
+ categories: string[];
137
165
  /** Most posts to list. `0` lists them all. */
138
166
  limit: number;
139
167
  layout: BlogLayout;
140
- /** Put a year heading above each year's posts. */
141
- groupByYear: boolean;
168
+ /** Put a heading above each year's or month's posts. */
169
+ groupBy: BlogGroupBy;
142
170
  /** Show the post's tags on each card. */
143
171
  showTags: boolean;
172
+ /** Show the post's category above its title on each card. */
173
+ showCategory: boolean;
174
+ /** List every category above the posts, each one a filter. */
175
+ categoryList: boolean;
144
176
  /** List every keyword above the posts, each one a filter. */
145
177
  tagList: boolean;
178
+ /** List the years and months that have posts above the posts, each one a filter. */
179
+ archive: boolean;
146
180
  /** Posts per page. `0` shows them all on one page. */
147
181
  pageSize: number;
148
- /** Most sticky posts pinned to the top. `0` pins them all. */
149
- stickyLimit: number;
182
+ /** Most pinned posts kept at the top. `0` pins them all. */
183
+ pinLimit: number;
150
184
  /** Show a "Subscribe" link to the blog's feed. */
151
185
  rssLink: boolean;
152
186
  feed: BlogFeedConfig | null;
@@ -174,14 +208,34 @@ interface BlogPostData {
174
208
  tags: string[];
175
209
  category: string;
176
210
  scope: BlogScope;
177
- sticky: boolean;
211
+ pinned: boolean;
178
212
  draft: boolean;
213
+ /** Shown in the announcement banner above the nav bar. */
214
+ announcement: boolean;
215
+ /** The banner's text, from `announcement: "…"`. `''` uses the title. */
216
+ announcementText: string;
179
217
  /** Per-post overrides of the `byline`, `cover` and `postNav` options. */
180
218
  byline?: boolean;
181
219
  cover?: boolean;
182
220
  postNav?: boolean;
183
221
  readingMinutes: number;
184
222
  }
223
+ /** One announcement, as the banner shows it. */
224
+ interface BlogAnnouncementItem {
225
+ /** The post's path and date: what a dismissal remembers, so re-dating a post announces it again. */
226
+ id: string;
227
+ text: string;
228
+ /** The post's URL path, without the site's base. */
229
+ link: string;
230
+ }
231
+ /** What the announcement banner reads from VitePress's site data. */
232
+ interface BlogAnnouncementData {
233
+ /** Newest first: the banner shows the first one that hasn't been dismissed. */
234
+ items: BlogAnnouncementItem[];
235
+ /** The blog page filtered to announcements (`/blog/?announcements`), without the base, or `''` when no blog lists them. */
236
+ listLink: string;
237
+ labels: Pick<BlogLabels, 'announcement' | 'announcementCount' | 'dismiss'>;
238
+ }
185
239
 
186
240
  /**
187
241
  * A markdown-it plugin that turns pages into a blog.
@@ -210,4 +264,4 @@ interface BlogPostData {
210
264
  */
211
265
  declare function blogMarkdown(md: MarkdownIt, options?: BlogOptions): void;
212
266
 
213
- export { type BlogAuthor as B, DEFAULT_LABELS as D, type BlogFeedConfig as a, type BlogIndexConfig as b, type BlogLabels as c, type BlogLayout as d, type BlogOptions as e, type BlogPostData as f, type BlogScope as g, blogMarkdown as h };
267
+ export { type BlogAnnouncementData as B, DEFAULT_LABELS as D, type BlogAnnouncementItem as a, type BlogAuthor as b, type BlogFeedConfig as c, type BlogGroupBy as d, type BlogIndexConfig as e, type BlogLabels as f, type BlogLayout as g, type BlogOptions as h, type BlogPostData as i, type BlogScope as j, blogMarkdown as k };
@@ -64,10 +64,12 @@ interface BlogOptions {
64
64
  */
65
65
  pageSize?: number;
66
66
  /**
67
- * Most sticky posts pinned to the top of a blog page, for those that don't
68
- * set `stickyLimit`. Extra sticky posts take their place by date. `0` pins
69
- * them all. Default: `0`.
67
+ * Most `pinned: true` posts kept at the top of a blog page, for those that
68
+ * don't set `pinLimit`. Extra pinned posts take their place by date. `0`
69
+ * pins them all. Default: `0`.
70
70
  */
71
+ pinLimit?: number;
72
+ /** @deprecated Renamed `pinLimit`; still read when `pinLimit` isn't set. */
71
73
  stickyLimit?: number;
72
74
  /**
73
75
  * Show a "Subscribe" RSS link on blog pages and `::: blog-posts` blocks,
@@ -75,7 +77,7 @@ interface BlogOptions {
75
77
  * on a site with a site URL (without one, no feeds are written). Default: `true`.
76
78
  */
77
79
  rssLink?: boolean;
78
- /** Words the plugin writes on pages, for translating. `{n}`, `{blog}` and `{tag}` are filled in. */
80
+ /** Words the plugin writes on pages, for translating. `{n}`, `{blog}` and `{filter}` are filled in. */
79
81
  labels?: Partial<BlogLabels>;
80
82
  }
81
83
  interface BlogLabels {
@@ -94,19 +96,41 @@ interface BlogLabels {
94
96
  /** The link back to a post's blog: "All posts in {blog}". */
95
97
  allPosts: string;
96
98
  draft: string;
97
- /** Badge on a sticky post. */
98
- sticky: string;
99
+ /** Badge on a pinned post. */
100
+ pinned: string;
101
+ /** Badge on an announcement, and the accessible name of the announcement banner. */
102
+ announcement: string;
103
+ /** A blog page's announcements filter (`?announcements`), in the active filters. */
104
+ announcements: string;
105
+ /** Tooltip of the banner's count badge: "{n} announcements". */
106
+ announcementCount: string;
107
+ /** Accessible name of the banner's close button. */
108
+ dismiss: string;
99
109
  noPosts: string;
100
- /** Year heading for posts without a date, when a blog groups by year. */
110
+ /** Group heading for posts without a date, when a blog groups by year or month. */
101
111
  undated: string;
102
- /** Label of a blog page's keyword list. */
112
+ /** Accessible name of the browse panel above a blog page's posts. */
113
+ browse: string;
114
+ /** Label of the browse panel's category row. */
115
+ categories: string;
116
+ /** Label of the browse panel's keyword row. */
103
117
  tags: string;
104
- /** Above a list filtered by keyword: "Posts tagged {tag}". */
105
- tagged: string;
106
- /** Link that clears the keyword filter. */
118
+ /** Label of the browse panel's year row. */
119
+ archive: string;
120
+ /** Names a category filter among the active filters: "Category". */
121
+ category: string;
122
+ /** Names a keyword filter among the active filters: "Keyword". */
123
+ tag: string;
124
+ /** How many posts the active filters match: "{n} posts". */
125
+ postCount: string;
126
+ /** The same, for one post: "{n} post". */
127
+ postCountOne: string;
128
+ /** When no post matches the active filters. */
129
+ noMatches: string;
130
+ /** Accessible name of an active filter's remove link: "Remove filter: {filter}". */
131
+ removeFilter: string;
132
+ /** Link that clears every filter. */
107
133
  showAll: string;
108
- /** When no post has the keyword: "No posts tagged {tag}." */
109
- noTagged: string;
110
134
  previous: string;
111
135
  next: string;
112
136
  /** Accessible name of the page links. */
@@ -119,6 +143,8 @@ interface BlogLabels {
119
143
  declare const DEFAULT_LABELS: BlogLabels;
120
144
  type BlogScope = 'site' | 'section';
121
145
  type BlogLayout = 'list' | 'grid' | 'compact';
146
+ /** How a blog page groups its posts under headings: by year, by month, or not at all (`''`). */
147
+ type BlogGroupBy = 'year' | 'month' | '';
122
148
  interface BlogFeedConfig {
123
149
  title?: string;
124
150
  description?: string;
@@ -134,19 +160,27 @@ interface BlogIndexConfig {
134
160
  folders: string[];
135
161
  /** Only list posts with at least one of these tags. */
136
162
  tags: string[];
163
+ /** Only list posts in one of these categories. */
164
+ categories: string[];
137
165
  /** Most posts to list. `0` lists them all. */
138
166
  limit: number;
139
167
  layout: BlogLayout;
140
- /** Put a year heading above each year's posts. */
141
- groupByYear: boolean;
168
+ /** Put a heading above each year's or month's posts. */
169
+ groupBy: BlogGroupBy;
142
170
  /** Show the post's tags on each card. */
143
171
  showTags: boolean;
172
+ /** Show the post's category above its title on each card. */
173
+ showCategory: boolean;
174
+ /** List every category above the posts, each one a filter. */
175
+ categoryList: boolean;
144
176
  /** List every keyword above the posts, each one a filter. */
145
177
  tagList: boolean;
178
+ /** List the years and months that have posts above the posts, each one a filter. */
179
+ archive: boolean;
146
180
  /** Posts per page. `0` shows them all on one page. */
147
181
  pageSize: number;
148
- /** Most sticky posts pinned to the top. `0` pins them all. */
149
- stickyLimit: number;
182
+ /** Most pinned posts kept at the top. `0` pins them all. */
183
+ pinLimit: number;
150
184
  /** Show a "Subscribe" link to the blog's feed. */
151
185
  rssLink: boolean;
152
186
  feed: BlogFeedConfig | null;
@@ -174,14 +208,34 @@ interface BlogPostData {
174
208
  tags: string[];
175
209
  category: string;
176
210
  scope: BlogScope;
177
- sticky: boolean;
211
+ pinned: boolean;
178
212
  draft: boolean;
213
+ /** Shown in the announcement banner above the nav bar. */
214
+ announcement: boolean;
215
+ /** The banner's text, from `announcement: "…"`. `''` uses the title. */
216
+ announcementText: string;
179
217
  /** Per-post overrides of the `byline`, `cover` and `postNav` options. */
180
218
  byline?: boolean;
181
219
  cover?: boolean;
182
220
  postNav?: boolean;
183
221
  readingMinutes: number;
184
222
  }
223
+ /** One announcement, as the banner shows it. */
224
+ interface BlogAnnouncementItem {
225
+ /** The post's path and date: what a dismissal remembers, so re-dating a post announces it again. */
226
+ id: string;
227
+ text: string;
228
+ /** The post's URL path, without the site's base. */
229
+ link: string;
230
+ }
231
+ /** What the announcement banner reads from VitePress's site data. */
232
+ interface BlogAnnouncementData {
233
+ /** Newest first: the banner shows the first one that hasn't been dismissed. */
234
+ items: BlogAnnouncementItem[];
235
+ /** The blog page filtered to announcements (`/blog/?announcements`), without the base, or `''` when no blog lists them. */
236
+ listLink: string;
237
+ labels: Pick<BlogLabels, 'announcement' | 'announcementCount' | 'dismiss'>;
238
+ }
185
239
 
186
240
  /**
187
241
  * A markdown-it plugin that turns pages into a blog.
@@ -210,4 +264,4 @@ interface BlogPostData {
210
264
  */
211
265
  declare function blogMarkdown(md: MarkdownIt, options?: BlogOptions): void;
212
266
 
213
- export { type BlogAuthor as B, DEFAULT_LABELS as D, type BlogFeedConfig as a, type BlogIndexConfig as b, type BlogLabels as c, type BlogLayout as d, type BlogOptions as e, type BlogPostData as f, type BlogScope as g, blogMarkdown as h };
267
+ export { type BlogAnnouncementData as B, DEFAULT_LABELS as D, type BlogAnnouncementItem as a, type BlogAuthor as b, type BlogFeedConfig as c, type BlogGroupBy as d, type BlogIndexConfig as e, type BlogLabels as f, type BlogLayout as g, type BlogOptions as h, type BlogPostData as i, type BlogScope as j, blogMarkdown as k };