@docusaurus/plugin-content-blog 0.0.0-4376 → 0.0.0-4383

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/lib/authors.d.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { Author, BlogContentPaths } from './types';
8
- import type { BlogPostFrontMatter } from './blogFrontMatter';
7
+ import type { BlogContentPaths } from './types';
8
+ import type { Author, BlogPostFrontMatter } from '@docusaurus/plugin-content-blog';
9
9
  export declare type AuthorsMap = Record<string, Author>;
10
10
  export declare function validateAuthorsMap(content: unknown): AuthorsMap;
11
11
  export declare function getAuthorsMap(params: {
@@ -4,38 +4,5 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { FrontMatterTag } from '@docusaurus/utils';
8
- export declare type BlogPostFrontMatterAuthor = Record<string, unknown> & {
9
- key?: string;
10
- name?: string;
11
- imageURL?: string;
12
- url?: string;
13
- title?: string;
14
- };
15
- export declare type BlogPostFrontMatterAuthors = string | BlogPostFrontMatterAuthor | (string | BlogPostFrontMatterAuthor)[];
16
- export declare type BlogPostFrontMatter = {
17
- id?: string;
18
- title?: string;
19
- description?: string;
20
- tags?: FrontMatterTag[];
21
- slug?: string;
22
- draft?: boolean;
23
- date?: Date | string;
24
- authors?: BlogPostFrontMatterAuthors;
25
- author?: string;
26
- author_title?: string;
27
- author_url?: string;
28
- author_image_url?: string;
29
- /** @deprecated */
30
- authorTitle?: string;
31
- /** @deprecated */
32
- authorURL?: string;
33
- /** @deprecated */
34
- authorImageURL?: string;
35
- image?: string;
36
- keywords?: string[];
37
- hide_table_of_contents?: boolean;
38
- toc_min_heading_level?: number;
39
- toc_max_heading_level?: number;
40
- };
7
+ import type { BlogPostFrontMatter } from '@docusaurus/plugin-content-blog';
41
8
  export declare function validateBlogPostFrontMatter(frontMatter: Record<string, unknown>): BlogPostFrontMatter;
@@ -4,8 +4,9 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { PluginOptions, BlogPost, BlogContentPaths, BlogMarkdownLoaderOptions, BlogTags } from './types';
7
+ import type { BlogPost, BlogContentPaths, BlogMarkdownLoaderOptions, BlogTags } from './types';
8
8
  import type { LoadContext } from '@docusaurus/types';
9
+ import type { PluginOptions } from '@docusaurus/plugin-content-blog';
9
10
  export declare function truncate(fileString: string, truncateMarker: RegExp): string;
10
11
  export declare function getSourceToPermalink(blogPosts: BlogPost[]): Record<string, string>;
11
12
  export declare function getBlogTags(blogPosts: BlogPost[]): BlogTags;
package/lib/feed.d.ts CHANGED
@@ -5,8 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Feed } from 'feed';
8
- import type { PluginOptions, BlogPost } from './types';
8
+ import type { BlogPost } from './types';
9
9
  import type { DocusaurusConfig } from '@docusaurus/types';
10
+ import type { PluginOptions } from '@docusaurus/plugin-content-blog';
10
11
  export declare function generateBlogFeed({ blogPosts, options, siteConfig, }: {
11
12
  blogPosts: BlogPost[];
12
13
  options: PluginOptions;
package/lib/index.d.ts CHANGED
@@ -4,7 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { PluginOptions, BlogContent } from './types';
7
+ import type { BlogContent } from './types';
8
8
  import type { LoadContext, Plugin, OptionValidationContext, ValidationResult } from '@docusaurus/types';
9
+ import type { PluginOptions } from '@docusaurus/plugin-content-blog';
9
10
  export default function pluginContentBlog(context: LoadContext, options: PluginOptions): Promise<Plugin<BlogContent>>;
10
11
  export declare function validateOptions({ validate, options, }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions>;
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Joi } from '@docusaurus/utils-validation';
8
- import type { PluginOptions } from './types';
8
+ import type { PluginOptions } from '@docusaurus/plugin-content-blog';
9
9
  export declare const DEFAULT_OPTIONS: PluginOptions;
10
10
  export declare const PluginOptionSchema: Joi.ObjectSchema<PluginOptions>;
@@ -4,7 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { BlogContent, PluginOptions } from './types';
7
+ import type { BlogContent } from './types';
8
8
  import type { TranslationFiles } from '@docusaurus/types';
9
+ import type { PluginOptions } from '@docusaurus/plugin-content-blog';
9
10
  export declare function getTranslationFiles(options: PluginOptions): TranslationFiles;
10
11
  export declare function translateContent(content: BlogContent, translationFiles: TranslationFiles): BlogContent;
package/lib/types.d.ts CHANGED
@@ -4,11 +4,9 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { RemarkAndRehypePluginOptions } from '@docusaurus/mdx-loader';
8
7
  import type { Tag } from '@docusaurus/utils';
9
8
  import type { BrokenMarkdownLink, ContentPaths } from '@docusaurus/utils/lib/markdownLinks';
10
- import type { Overwrite } from 'utility-types';
11
- import type { BlogPostFrontMatter } from './blogFrontMatter';
9
+ import type { BlogPostFrontMatter, Author } from '@docusaurus/plugin-content-blog';
12
10
  export declare type BlogContentPaths = ContentPaths;
13
11
  export interface BlogContent {
14
12
  blogSidebarTitle: string;
@@ -17,71 +15,6 @@ export interface BlogContent {
17
15
  blogTags: BlogTags;
18
16
  blogTagsListPath: string | null;
19
17
  }
20
- export declare type FeedType = 'rss' | 'atom' | 'json';
21
- export declare type FeedOptions = {
22
- type?: FeedType[] | null;
23
- title?: string;
24
- description?: string;
25
- copyright: string;
26
- language?: string;
27
- };
28
- export declare type UserFeedOptions = Overwrite<Partial<FeedOptions>, {
29
- type?: FeedOptions['type'] | 'all';
30
- }>;
31
- export declare type EditUrlFunction = (editUrlParams: {
32
- blogDirPath: string;
33
- blogPath: string;
34
- permalink: string;
35
- locale: string;
36
- }) => string | undefined;
37
- declare type ReadingTimeOptions = {
38
- wordsPerMinute?: number;
39
- wordBound?: (char: string) => boolean;
40
- };
41
- export declare type ReadingTimeFunction = (params: {
42
- content: string;
43
- frontMatter?: BlogPostFrontMatter & Record<string, unknown>;
44
- options?: ReadingTimeOptions;
45
- }) => number;
46
- export declare type ReadingTimeFunctionOption = (params: Required<Omit<Parameters<ReadingTimeFunction>[0], 'options'>> & {
47
- defaultReadingTime: ReadingTimeFunction;
48
- }) => number | undefined;
49
- export declare type PluginOptions = RemarkAndRehypePluginOptions & {
50
- id?: string;
51
- path: string;
52
- routeBasePath: string;
53
- tagsBasePath: string;
54
- archiveBasePath: string;
55
- include: string[];
56
- exclude: string[];
57
- postsPerPage: number | 'ALL';
58
- blogListComponent: string;
59
- blogPostComponent: string;
60
- blogTagsListComponent: string;
61
- blogTagsPostsComponent: string;
62
- blogTitle: string;
63
- blogDescription: string;
64
- blogSidebarCount: number | 'ALL';
65
- blogSidebarTitle: string;
66
- truncateMarker: RegExp;
67
- showReadingTime: boolean;
68
- feedOptions: {
69
- type?: FeedType[] | null;
70
- title?: string;
71
- description?: string;
72
- copyright: string;
73
- language?: string;
74
- };
75
- editUrl?: string | EditUrlFunction;
76
- editLocalizedFiles?: boolean;
77
- admonitions: Record<string, unknown>;
78
- authorsMapPath: string;
79
- readingTime: ReadingTimeFunctionOption;
80
- sortPosts: 'ascending' | 'descending';
81
- };
82
- export declare type UserPluginOptions = Overwrite<Partial<PluginOptions>, {
83
- feedOptions?: UserFeedOptions;
84
- }>;
85
18
  export interface BlogTags {
86
19
  [key: string]: BlogTag;
87
20
  }
@@ -110,12 +43,6 @@ export interface BlogPaginated {
110
43
  metadata: BlogPaginatedMetadata;
111
44
  items: string[];
112
45
  }
113
- export interface Author extends Record<string, unknown> {
114
- name?: string;
115
- imageURL?: string;
116
- url?: string;
117
- title?: string;
118
- }
119
46
  export interface MetaData {
120
47
  permalink: string;
121
48
  source: string;
@@ -132,10 +59,6 @@ export interface MetaData {
132
59
  authors: Author[];
133
60
  frontMatter: BlogPostFrontMatter & Record<string, unknown>;
134
61
  }
135
- export interface Assets {
136
- image?: string;
137
- authorsImageUrls: (string | undefined)[];
138
- }
139
62
  export interface Paginator {
140
63
  title: string;
141
64
  permalink: string;
@@ -161,4 +84,3 @@ export declare type BlogMarkdownLoaderOptions = {
161
84
  sourceToPermalink: Record<string, string>;
162
85
  onBrokenMarkdownLink: (brokenMarkdownLink: BlogBrokenMarkdownLink) => void;
163
86
  };
164
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4376",
3
+ "version": "0.0.0-4383",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "0.0.0-4376",
22
- "@docusaurus/logger": "0.0.0-4376",
23
- "@docusaurus/mdx-loader": "0.0.0-4376",
24
- "@docusaurus/utils": "0.0.0-4376",
25
- "@docusaurus/utils-validation": "0.0.0-4376",
21
+ "@docusaurus/core": "0.0.0-4383",
22
+ "@docusaurus/logger": "0.0.0-4383",
23
+ "@docusaurus/mdx-loader": "0.0.0-4383",
24
+ "@docusaurus/utils": "0.0.0-4383",
25
+ "@docusaurus/utils-validation": "0.0.0-4383",
26
26
  "escape-string-regexp": "^4.0.0",
27
27
  "feed": "^4.2.2",
28
28
  "fs-extra": "^10.0.0",
@@ -36,7 +36,7 @@
36
36
  "webpack": "^5.61.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@docusaurus/types": "0.0.0-4376"
39
+ "@docusaurus/types": "0.0.0-4383"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^16.8.4 || ^17.0.0",
@@ -45,5 +45,5 @@
45
45
  "engines": {
46
46
  "node": ">=14"
47
47
  },
48
- "gitHead": "d95874b8c1ad60ed595d2088f23284df72903c29"
48
+ "gitHead": "6ccc0daea1a7b1413cd32f515a9e661c4007a355"
49
49
  }
package/src/authors.ts CHANGED
@@ -5,14 +5,15 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import type {Author, BlogContentPaths} from './types';
8
+ import type {BlogContentPaths} from './types';
9
9
  import {getDataFileData} from '@docusaurus/utils';
10
10
  import {Joi, URISchema} from '@docusaurus/utils-validation';
11
11
  import type {
12
+ Author,
12
13
  BlogPostFrontMatter,
13
14
  BlogPostFrontMatterAuthor,
14
15
  BlogPostFrontMatterAuthors,
15
- } from './blogFrontMatter';
16
+ } from '@docusaurus/plugin-content-blog';
16
17
 
17
18
  export type AuthorsMap = Record<string, Author>;
18
19
 
@@ -12,21 +12,7 @@ import {
12
12
  FrontMatterTagsSchema,
13
13
  FrontMatterTOCHeadingLevels,
14
14
  } from '@docusaurus/utils-validation';
15
- import type {FrontMatterTag} from '@docusaurus/utils';
16
-
17
- export type BlogPostFrontMatterAuthor = Record<string, unknown> & {
18
- key?: string;
19
- name?: string;
20
- imageURL?: string;
21
- url?: string;
22
- title?: string;
23
- };
24
-
25
- // All the possible variants that the user can use for convenience
26
- export type BlogPostFrontMatterAuthors =
27
- | string
28
- | BlogPostFrontMatterAuthor
29
- | (string | BlogPostFrontMatterAuthor)[];
15
+ import type {BlogPostFrontMatter} from '@docusaurus/plugin-content-blog';
30
16
 
31
17
  const BlogPostFrontMatterAuthorSchema = Joi.object({
32
18
  key: Joi.string(),
@@ -38,37 +24,6 @@ const BlogPostFrontMatterAuthorSchema = Joi.object({
38
24
  .or('key', 'name')
39
25
  .rename('image_url', 'imageURL', {alias: true});
40
26
 
41
- export type BlogPostFrontMatter = {
42
- id?: string;
43
- title?: string;
44
- description?: string;
45
- tags?: FrontMatterTag[];
46
- slug?: string;
47
- draft?: boolean;
48
- date?: Date | string; // Yaml automagically convert some string patterns as Date, but not all
49
-
50
- authors?: BlogPostFrontMatterAuthors;
51
-
52
- // We may want to deprecate those older author frontmatter fields later:
53
- author?: string;
54
- author_title?: string;
55
- author_url?: string;
56
- author_image_url?: string;
57
-
58
- /** @deprecated */
59
- authorTitle?: string;
60
- /** @deprecated */
61
- authorURL?: string;
62
- /** @deprecated */
63
- authorImageURL?: string;
64
-
65
- image?: string;
66
- keywords?: string[];
67
- hide_table_of_contents?: boolean;
68
- toc_min_heading_level?: number;
69
- toc_max_heading_level?: number;
70
- };
71
-
72
27
  const FrontMatterAuthorErrorMessage =
73
28
  '{{#label}} does not look like a valid blog post author. Please use an author key or an author object (with a key and/or name).';
74
29
 
package/src/blogUtils.ts CHANGED
@@ -10,12 +10,10 @@ import path from 'path';
10
10
  import readingTime from 'reading-time';
11
11
  import {keyBy, mapValues} from 'lodash';
12
12
  import type {
13
- PluginOptions,
14
13
  BlogPost,
15
14
  BlogContentPaths,
16
15
  BlogMarkdownLoaderOptions,
17
16
  BlogTags,
18
- ReadingTimeFunction,
19
17
  } from './types';
20
18
  import {
21
19
  parseMarkdownFile,
@@ -34,6 +32,10 @@ import type {LoadContext} from '@docusaurus/types';
34
32
  import {validateBlogPostFrontMatter} from './blogFrontMatter';
35
33
  import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
36
34
  import logger from '@docusaurus/logger';
35
+ import type {
36
+ PluginOptions,
37
+ ReadingTimeFunction,
38
+ } from '@docusaurus/plugin-content-blog';
37
39
 
38
40
  export function truncate(fileString: string, truncateMarker: RegExp): string {
39
41
  return fileString.split(truncateMarker, 1).shift()!;
package/src/feed.ts CHANGED
@@ -6,11 +6,16 @@
6
6
  */
7
7
 
8
8
  import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
9
- import type {PluginOptions, Author, BlogPost, FeedType} from './types';
9
+ import type {BlogPost} from './types';
10
10
  import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
11
11
  import type {DocusaurusConfig} from '@docusaurus/types';
12
12
  import path from 'path';
13
13
  import fs from 'fs-extra';
14
+ import type {
15
+ FeedType,
16
+ PluginOptions,
17
+ Author,
18
+ } from '@docusaurus/plugin-content-blog';
14
19
 
15
20
  // TODO this is temporary until we handle mdxToHtml better
16
21
  // It's hard to convert reliably JSX/require calls to an html feed content
package/src/index.ts CHANGED
@@ -23,7 +23,6 @@ import {
23
23
  import {translateContent, getTranslationFiles} from './translations';
24
24
 
25
25
  import type {
26
- PluginOptions,
27
26
  BlogTags,
28
27
  BlogContent,
29
28
  BlogItemsToMetadata,
@@ -32,7 +31,6 @@ import type {
32
31
  BlogContentPaths,
33
32
  BlogMarkdownLoaderOptions,
34
33
  MetaData,
35
- Assets,
36
34
  } from './types';
37
35
  import {PluginOptionSchema} from './pluginOptionSchema';
38
36
  import type {
@@ -50,8 +48,12 @@ import {
50
48
  getSourceToPermalink,
51
49
  getBlogTags,
52
50
  } from './blogUtils';
53
- import type {BlogPostFrontMatter} from './blogFrontMatter';
54
51
  import {createBlogFeedFiles} from './feed';
52
+ import type {
53
+ PluginOptions,
54
+ BlogPostFrontMatter,
55
+ Assets,
56
+ } from '@docusaurus/plugin-content-blog';
55
57
 
56
58
  export default async function pluginContentBlog(
57
59
  context: LoadContext,
@@ -6,7 +6,145 @@
6
6
  */
7
7
 
8
8
  declare module '@docusaurus/plugin-content-blog' {
9
- export type Options = Partial<import('./types').UserPluginOptions>;
9
+ import type {RemarkAndRehypePluginOptions} from '@docusaurus/mdx-loader';
10
+ import type {FrontMatterTag} from '@docusaurus/utils';
11
+ import type {Overwrite} from 'utility-types';
12
+
13
+ export interface Assets {
14
+ image?: string;
15
+ authorsImageUrls: (string | undefined)[]; // Array of same size as the original MetaData.authors array
16
+ }
17
+
18
+ // We allow passing custom fields to authors, e.g., twitter
19
+ export interface Author extends Record<string, unknown> {
20
+ name?: string;
21
+ imageURL?: string;
22
+ url?: string;
23
+ title?: string;
24
+ }
25
+
26
+ export type BlogPostFrontMatter = {
27
+ id?: string;
28
+ title?: string;
29
+ description?: string;
30
+ tags?: FrontMatterTag[];
31
+ slug?: string;
32
+ draft?: boolean;
33
+ date?: Date | string; // Yaml automagically convert some string patterns as Date, but not all
34
+
35
+ authors?: BlogPostFrontMatterAuthors;
36
+
37
+ // We may want to deprecate those older author frontmatter fields later:
38
+ author?: string;
39
+ author_title?: string;
40
+ author_url?: string;
41
+ author_image_url?: string;
42
+
43
+ /** @deprecated */
44
+ authorTitle?: string;
45
+ /** @deprecated */
46
+ authorURL?: string;
47
+ /** @deprecated */
48
+ authorImageURL?: string;
49
+
50
+ image?: string;
51
+ keywords?: string[];
52
+ hide_table_of_contents?: boolean;
53
+ toc_min_heading_level?: number;
54
+ toc_max_heading_level?: number;
55
+ };
56
+
57
+ export type BlogPostFrontMatterAuthor = Record<string, unknown> & {
58
+ key?: string;
59
+ name?: string;
60
+ imageURL?: string;
61
+ url?: string;
62
+ title?: string;
63
+ };
64
+
65
+ // All the possible variants that the user can use for convenience
66
+ export type BlogPostFrontMatterAuthors =
67
+ | string
68
+ | BlogPostFrontMatterAuthor
69
+ | (string | BlogPostFrontMatterAuthor)[];
70
+
71
+ export type EditUrlFunction = (editUrlParams: {
72
+ blogDirPath: string;
73
+ blogPath: string;
74
+ permalink: string;
75
+ locale: string;
76
+ }) => string | undefined;
77
+
78
+ export type FeedType = 'rss' | 'atom' | 'json';
79
+ export type FeedOptions = {
80
+ type?: FeedType[] | null;
81
+ title?: string;
82
+ description?: string;
83
+ copyright: string;
84
+ language?: string;
85
+ };
86
+ // Feed options, as provided by user config
87
+ export type UserFeedOptions = Overwrite<
88
+ Partial<FeedOptions>,
89
+ {type?: FeedOptions['type'] | 'all'} // Handle the type: "all" shortcut
90
+ >;
91
+
92
+ // Duplicate from ngryman/reading-time to keep stability of API
93
+ type ReadingTimeOptions = {
94
+ wordsPerMinute?: number;
95
+ wordBound?: (char: string) => boolean;
96
+ };
97
+
98
+ export type ReadingTimeFunction = (params: {
99
+ content: string;
100
+ frontMatter?: BlogPostFrontMatter & Record<string, unknown>;
101
+ options?: ReadingTimeOptions;
102
+ }) => number;
103
+
104
+ export type ReadingTimeFunctionOption = (
105
+ params: Required<Omit<Parameters<ReadingTimeFunction>[0], 'options'>> & {
106
+ defaultReadingTime: ReadingTimeFunction;
107
+ },
108
+ ) => number | undefined;
109
+
110
+ export type PluginOptions = RemarkAndRehypePluginOptions & {
111
+ id?: string;
112
+ path: string;
113
+ routeBasePath: string;
114
+ tagsBasePath: string;
115
+ archiveBasePath: string;
116
+ include: string[];
117
+ exclude: string[];
118
+ postsPerPage: number | 'ALL';
119
+ blogListComponent: string;
120
+ blogPostComponent: string;
121
+ blogTagsListComponent: string;
122
+ blogTagsPostsComponent: string;
123
+ blogTitle: string;
124
+ blogDescription: string;
125
+ blogSidebarCount: number | 'ALL';
126
+ blogSidebarTitle: string;
127
+ truncateMarker: RegExp;
128
+ showReadingTime: boolean;
129
+ feedOptions: {
130
+ type?: FeedType[] | null;
131
+ title?: string;
132
+ description?: string;
133
+ copyright: string;
134
+ language?: string;
135
+ };
136
+ editUrl?: string | EditUrlFunction;
137
+ editLocalizedFiles?: boolean;
138
+ admonitions: Record<string, unknown>;
139
+ authorsMapPath: string;
140
+ readingTime: ReadingTimeFunctionOption;
141
+ sortPosts: 'ascending' | 'descending';
142
+ };
143
+ // Options, as provided in the user config (before normalization)
144
+ export type Options = Overwrite<
145
+ Partial<PluginOptions>,
146
+ {feedOptions?: UserFeedOptions}
147
+ >;
10
148
  }
11
149
 
12
150
  declare module '@theme/BlogSidebar' {
@@ -27,9 +165,13 @@ declare module '@theme/BlogSidebar' {
27
165
  declare module '@theme/BlogPostPage' {
28
166
  import type {BlogSidebar} from '@theme/BlogSidebar';
29
167
  import type {TOCItem} from '@docusaurus/types';
168
+ import type {
169
+ BlogPostFrontMatter,
170
+ Author,
171
+ Assets,
172
+ } from '@docusaurus/plugin-content-blog';
30
173
 
31
- export type FrontMatter = import('./blogFrontMatter').BlogPostFrontMatter;
32
- export type Assets = import('./types').Assets;
174
+ export type FrontMatter = BlogPostFrontMatter;
33
175
 
34
176
  export type Metadata = {
35
177
  readonly title: string;
@@ -42,7 +184,7 @@ declare module '@theme/BlogPostPage' {
42
184
  readonly truncated?: string;
43
185
  readonly nextItem?: {readonly title: string; readonly permalink: string};
44
186
  readonly prevItem?: {readonly title: string; readonly permalink: string};
45
- readonly authors: import('./types').Author[];
187
+ readonly authors: Author[];
46
188
  readonly frontMatter: FrontMatter & Record<string, unknown>;
47
189
  readonly tags: readonly {
48
190
  readonly label: string;
@@ -13,7 +13,7 @@ import {
13
13
  URISchema,
14
14
  } from '@docusaurus/utils-validation';
15
15
  import {GlobExcludeDefault} from '@docusaurus/utils';
16
- import type {PluginOptions} from './types';
16
+ import type {PluginOptions} from '@docusaurus/plugin-content-blog';
17
17
 
18
18
  export const DEFAULT_OPTIONS: PluginOptions = {
19
19
  feedOptions: {type: ['rss', 'atom'], copyright: ''},
@@ -5,8 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import type {BlogContent, PluginOptions, BlogPaginated} from './types';
8
+ import type {BlogContent, BlogPaginated} from './types';
9
9
  import type {TranslationFileContent, TranslationFiles} from '@docusaurus/types';
10
+ import type {PluginOptions} from '@docusaurus/plugin-content-blog';
10
11
 
11
12
  function translateListPage(
12
13
  blogListPaginated: BlogPaginated[],
package/src/types.ts CHANGED
@@ -5,14 +5,15 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import type {RemarkAndRehypePluginOptions} from '@docusaurus/mdx-loader';
9
8
  import type {Tag} from '@docusaurus/utils';
10
9
  import type {
11
10
  BrokenMarkdownLink,
12
11
  ContentPaths,
13
12
  } from '@docusaurus/utils/lib/markdownLinks';
14
- import type {Overwrite} from 'utility-types';
15
- import type {BlogPostFrontMatter} from './blogFrontMatter';
13
+ import type {
14
+ BlogPostFrontMatter,
15
+ Author,
16
+ } from '@docusaurus/plugin-content-blog';
16
17
 
17
18
  export type BlogContentPaths = ContentPaths;
18
19
 
@@ -24,87 +25,6 @@ export interface BlogContent {
24
25
  blogTagsListPath: string | null;
25
26
  }
26
27
 
27
- export type FeedType = 'rss' | 'atom' | 'json';
28
-
29
- export type FeedOptions = {
30
- type?: FeedType[] | null;
31
- title?: string;
32
- description?: string;
33
- copyright: string;
34
- language?: string;
35
- };
36
-
37
- // Feed options, as provided by user config
38
- export type UserFeedOptions = Overwrite<
39
- Partial<FeedOptions>,
40
- {type?: FeedOptions['type'] | 'all'} // Handle the type: "all" shortcut
41
- >;
42
-
43
- export type EditUrlFunction = (editUrlParams: {
44
- blogDirPath: string;
45
- blogPath: string;
46
- permalink: string;
47
- locale: string;
48
- }) => string | undefined;
49
-
50
- // Duplicate from ngryman/reading-time to keep stability of API
51
- type ReadingTimeOptions = {
52
- wordsPerMinute?: number;
53
- wordBound?: (char: string) => boolean;
54
- };
55
-
56
- export type ReadingTimeFunction = (params: {
57
- content: string;
58
- frontMatter?: BlogPostFrontMatter & Record<string, unknown>;
59
- options?: ReadingTimeOptions;
60
- }) => number;
61
-
62
- export type ReadingTimeFunctionOption = (
63
- params: Required<Omit<Parameters<ReadingTimeFunction>[0], 'options'>> & {
64
- defaultReadingTime: ReadingTimeFunction;
65
- },
66
- ) => number | undefined;
67
-
68
- export type PluginOptions = RemarkAndRehypePluginOptions & {
69
- id?: string;
70
- path: string;
71
- routeBasePath: string;
72
- tagsBasePath: string;
73
- archiveBasePath: string;
74
- include: string[];
75
- exclude: string[];
76
- postsPerPage: number | 'ALL';
77
- blogListComponent: string;
78
- blogPostComponent: string;
79
- blogTagsListComponent: string;
80
- blogTagsPostsComponent: string;
81
- blogTitle: string;
82
- blogDescription: string;
83
- blogSidebarCount: number | 'ALL';
84
- blogSidebarTitle: string;
85
- truncateMarker: RegExp;
86
- showReadingTime: boolean;
87
- feedOptions: {
88
- type?: FeedType[] | null;
89
- title?: string;
90
- description?: string;
91
- copyright: string;
92
- language?: string;
93
- };
94
- editUrl?: string | EditUrlFunction;
95
- editLocalizedFiles?: boolean;
96
- admonitions: Record<string, unknown>;
97
- authorsMapPath: string;
98
- readingTime: ReadingTimeFunctionOption;
99
- sortPosts: 'ascending' | 'descending';
100
- };
101
-
102
- // Options, as provided in the user config (before normalization)
103
- export type UserPluginOptions = Overwrite<
104
- Partial<PluginOptions>,
105
- {feedOptions?: UserFeedOptions}
106
- >;
107
-
108
28
  export interface BlogTags {
109
29
  [key: string]: BlogTag;
110
30
  }
@@ -138,14 +58,6 @@ export interface BlogPaginated {
138
58
  items: string[];
139
59
  }
140
60
 
141
- // We allow passing custom fields to authors, e.g., twitter
142
- export interface Author extends Record<string, unknown> {
143
- name?: string;
144
- imageURL?: string;
145
- url?: string;
146
- title?: string;
147
- }
148
-
149
61
  export interface MetaData {
150
62
  permalink: string;
151
63
  source: string;
@@ -163,11 +75,6 @@ export interface MetaData {
163
75
  frontMatter: BlogPostFrontMatter & Record<string, unknown>;
164
76
  }
165
77
 
166
- export interface Assets {
167
- image?: string;
168
- authorsImageUrls: (string | undefined)[]; // Array of same size as the original MetaData.authors array
169
- }
170
-
171
78
  export interface Paginator {
172
79
  title: string;
173
80
  permalink: string;