@docusaurus/plugin-content-blog 2.0.0-beta.ff31de0ff → 2.0.0-rc.1
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 +22 -0
- package/lib/authors.js +122 -0
- package/lib/blogUtils.d.ts +27 -7
- package/lib/blogUtils.js +214 -141
- package/lib/feed.d.ts +15 -0
- package/lib/feed.js +102 -0
- package/lib/frontMatter.d.ts +10 -0
- package/lib/frontMatter.js +62 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +179 -205
- package/lib/markdownLoader.d.ts +3 -6
- package/lib/markdownLoader.js +6 -7
- package/lib/options.d.ts +10 -0
- package/lib/{pluginOptionSchema.js → options.js} +44 -14
- package/lib/remark/footnoteIDFixer.d.ts +14 -0
- package/lib/remark/footnoteIDFixer.js +29 -0
- package/lib/translations.d.ts +10 -0
- package/lib/translations.js +53 -0
- package/lib/types.d.ts +4 -109
- package/package.json +23 -18
- package/src/authors.ts +168 -0
- package/src/blogUtils.ts +316 -196
- package/src/feed.ts +171 -0
- package/src/frontMatter.ts +81 -0
- package/src/index.ts +246 -268
- package/src/markdownLoader.ts +11 -16
- package/src/{pluginOptionSchema.ts → options.ts} +57 -16
- package/src/plugin-content-blog.d.ts +587 -0
- package/src/remark/footnoteIDFixer.ts +29 -0
- package/src/translations.ts +69 -0
- package/src/types.ts +2 -128
- package/index.d.ts +0 -138
- package/lib/.tsbuildinfo +0 -4415
- package/lib/blogFrontMatter.d.ts +0 -28
- package/lib/blogFrontMatter.js +0 -50
- package/lib/pluginOptionSchema.d.ts +0 -33
- package/src/__tests__/__fixtures__/website/blog/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
- package/src/__tests__/__fixtures__/website/blog/complex-slug.md +0 -7
- package/src/__tests__/__fixtures__/website/blog/date-matter.md +0 -5
- package/src/__tests__/__fixtures__/website/blog/draft.md +0 -6
- package/src/__tests__/__fixtures__/website/blog/heading-as-title.md +0 -5
- package/src/__tests__/__fixtures__/website/blog/simple-slug.md +0 -7
- package/src/__tests__/__fixtures__/website/blog-with-ref/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
- package/src/__tests__/__fixtures__/website/blog-with-ref/post-with-broken-links.md +0 -11
- package/src/__tests__/__fixtures__/website/blog-with-ref/post.md +0 -5
- package/src/__tests__/__fixtures__/website/i18n/en/docusaurus-plugin-content-blog/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
- package/src/__tests__/__fixtures__/website-blog-without-date/blog/no date.md +0 -1
- package/src/__tests__/__snapshots__/generateBlogFeed.test.ts.snap +0 -101
- package/src/__tests__/__snapshots__/linkify.test.ts.snap +0 -24
- package/src/__tests__/__snapshots__/pluginOptionSchema.test.ts.snap +0 -5
- package/src/__tests__/blogFrontMatter.test.ts +0 -265
- package/src/__tests__/generateBlogFeed.test.ts +0 -100
- package/src/__tests__/index.test.ts +0 -336
- package/src/__tests__/linkify.test.ts +0 -93
- package/src/__tests__/pluginOptionSchema.test.ts +0 -150
- package/src/blogFrontMatter.ts +0 -87
- package/tsconfig.json +0 -9
- package/types.d.ts +0 -13
package/src/types.ts
CHANGED
|
@@ -5,141 +5,15 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
10
|
-
BrokenMarkdownLink,
|
|
11
|
-
ContentPaths,
|
|
12
|
-
} from '@docusaurus/utils/lib/markdownLinks';
|
|
8
|
+
import type {BrokenMarkdownLink, ContentPaths} from '@docusaurus/utils';
|
|
13
9
|
|
|
14
10
|
export type BlogContentPaths = ContentPaths;
|
|
15
11
|
|
|
16
|
-
export interface BlogContent {
|
|
17
|
-
blogPosts: BlogPost[];
|
|
18
|
-
blogListPaginated: BlogPaginated[];
|
|
19
|
-
blogTags: BlogTags;
|
|
20
|
-
blogTagsListPath: string | null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface DateLink {
|
|
24
|
-
date: Date;
|
|
25
|
-
link: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type FeedType = 'rss' | 'atom';
|
|
29
|
-
|
|
30
|
-
export type EditUrlFunction = (editUrlParams: {
|
|
31
|
-
blogDirPath: string;
|
|
32
|
-
blogPath: string;
|
|
33
|
-
permalink: string;
|
|
34
|
-
locale: string;
|
|
35
|
-
}) => string | undefined;
|
|
36
|
-
|
|
37
|
-
export interface PluginOptions extends RemarkAndRehypePluginOptions {
|
|
38
|
-
id?: string;
|
|
39
|
-
path: string;
|
|
40
|
-
routeBasePath: string;
|
|
41
|
-
include: string[];
|
|
42
|
-
postsPerPage: number;
|
|
43
|
-
blogListComponent: string;
|
|
44
|
-
blogPostComponent: string;
|
|
45
|
-
blogTagsListComponent: string;
|
|
46
|
-
blogTagsPostsComponent: string;
|
|
47
|
-
blogTitle: string;
|
|
48
|
-
blogDescription: string;
|
|
49
|
-
blogSidebarCount: number | 'ALL';
|
|
50
|
-
blogSidebarTitle: string;
|
|
51
|
-
truncateMarker: RegExp;
|
|
52
|
-
showReadingTime: boolean;
|
|
53
|
-
feedOptions: {
|
|
54
|
-
type?: [FeedType] | null;
|
|
55
|
-
title?: string;
|
|
56
|
-
description?: string;
|
|
57
|
-
copyright: string;
|
|
58
|
-
language?: string;
|
|
59
|
-
};
|
|
60
|
-
editUrl?: string | EditUrlFunction;
|
|
61
|
-
editLocalizedFiles?: boolean;
|
|
62
|
-
admonitions: Record<string, unknown>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface BlogTags {
|
|
66
|
-
[key: string]: BlogTag;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface BlogTag {
|
|
70
|
-
name: string;
|
|
71
|
-
items: string[];
|
|
72
|
-
permalink: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface BlogPost {
|
|
76
|
-
id: string;
|
|
77
|
-
metadata: MetaData;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface BlogPaginatedMetadata {
|
|
81
|
-
permalink: string;
|
|
82
|
-
page: number;
|
|
83
|
-
postsPerPage: number;
|
|
84
|
-
totalPages: number;
|
|
85
|
-
totalCount: number;
|
|
86
|
-
previousPage: string | null;
|
|
87
|
-
nextPage: string | null;
|
|
88
|
-
blogTitle: string;
|
|
89
|
-
blogDescription: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface BlogPaginated {
|
|
93
|
-
metadata: BlogPaginatedMetadata;
|
|
94
|
-
items: string[];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface MetaData {
|
|
98
|
-
permalink: string;
|
|
99
|
-
source: string;
|
|
100
|
-
description: string;
|
|
101
|
-
date: Date;
|
|
102
|
-
formattedDate: string;
|
|
103
|
-
tags: (Tag | string)[];
|
|
104
|
-
title: string;
|
|
105
|
-
readingTime?: number;
|
|
106
|
-
prevItem?: Paginator;
|
|
107
|
-
nextItem?: Paginator;
|
|
108
|
-
truncated: boolean;
|
|
109
|
-
editUrl?: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface Paginator {
|
|
113
|
-
title: string;
|
|
114
|
-
permalink: string;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface Tag {
|
|
118
|
-
label: string;
|
|
119
|
-
permalink: string;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface BlogItemsToMetadata {
|
|
123
|
-
[key: string]: MetaData;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface TagsModule {
|
|
127
|
-
[key: string]: TagModule;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface TagModule {
|
|
131
|
-
allTagsPath: string;
|
|
132
|
-
slug: string;
|
|
133
|
-
name: string;
|
|
134
|
-
count: number;
|
|
135
|
-
permalink: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
12
|
export type BlogBrokenMarkdownLink = BrokenMarkdownLink<BlogContentPaths>;
|
|
139
13
|
export type BlogMarkdownLoaderOptions = {
|
|
140
14
|
siteDir: string;
|
|
141
15
|
contentPaths: BlogContentPaths;
|
|
142
16
|
truncateMarker: RegExp;
|
|
143
|
-
sourceToPermalink:
|
|
17
|
+
sourceToPermalink: {[aliasedPath: string]: string};
|
|
144
18
|
onBrokenMarkdownLink: (brokenMarkdownLink: BlogBrokenMarkdownLink) => void;
|
|
145
19
|
};
|
package/index.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/* eslint-disable import/no-duplicates */
|
|
9
|
-
/* eslint-disable camelcase */
|
|
10
|
-
|
|
11
|
-
declare module '@theme/BlogSidebar' {
|
|
12
|
-
export type BlogSidebarItem = {title: string; permalink: string};
|
|
13
|
-
export type BlogSidebar = {
|
|
14
|
-
title: string;
|
|
15
|
-
items: BlogSidebarItem[];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type Props = {
|
|
19
|
-
readonly sidebar: BlogSidebar;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const BlogSidebar: (props: Props) => JSX.Element;
|
|
23
|
-
export default BlogSidebar;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare module '@theme/BlogPostPage' {
|
|
27
|
-
import type {TOCItem} from '@docusaurus/types';
|
|
28
|
-
import type {BlogSidebar} from '@theme/BlogSidebar';
|
|
29
|
-
|
|
30
|
-
export type FrontMatter = {
|
|
31
|
-
readonly title: string;
|
|
32
|
-
readonly author?: string;
|
|
33
|
-
readonly image?: string;
|
|
34
|
-
readonly tags?: readonly string[];
|
|
35
|
-
readonly keywords?: readonly string[];
|
|
36
|
-
readonly author_url?: string;
|
|
37
|
-
readonly authorURL?: string;
|
|
38
|
-
readonly author_title?: string;
|
|
39
|
-
readonly authorTitle?: string;
|
|
40
|
-
readonly author_image_url?: string;
|
|
41
|
-
readonly authorImageURL?: string;
|
|
42
|
-
readonly hide_table_of_contents?: boolean;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type Metadata = {
|
|
46
|
-
readonly title: string;
|
|
47
|
-
readonly date: string;
|
|
48
|
-
readonly formattedDate: string;
|
|
49
|
-
readonly permalink: string;
|
|
50
|
-
readonly description?: string;
|
|
51
|
-
readonly editUrl?: string;
|
|
52
|
-
readonly readingTime?: number;
|
|
53
|
-
readonly truncated?: string;
|
|
54
|
-
readonly nextItem?: {readonly title: string; readonly permalink: string};
|
|
55
|
-
readonly prevItem?: {readonly title: string; readonly permalink: string};
|
|
56
|
-
readonly tags: readonly {
|
|
57
|
-
readonly label: string;
|
|
58
|
-
readonly permalink: string;
|
|
59
|
-
}[];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type Content = {
|
|
63
|
-
readonly frontMatter: FrontMatter;
|
|
64
|
-
readonly metadata: Metadata;
|
|
65
|
-
readonly toc: readonly TOCItem[];
|
|
66
|
-
(): JSX.Element;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type Props = {
|
|
70
|
-
readonly sidebar: BlogSidebar;
|
|
71
|
-
readonly content: Content;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const BlogPostPage: (props: Props) => JSX.Element;
|
|
75
|
-
export default BlogPostPage;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare module '@theme/BlogListPage' {
|
|
79
|
-
import type {Content} from '@theme/BlogPostPage';
|
|
80
|
-
import type {BlogSidebar} from '@theme/BlogSidebar';
|
|
81
|
-
|
|
82
|
-
export type Item = {
|
|
83
|
-
readonly content: () => JSX.Element;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export type Metadata = {
|
|
87
|
-
readonly blogTitle: string;
|
|
88
|
-
readonly blogDescription: string;
|
|
89
|
-
readonly nextPage?: string;
|
|
90
|
-
readonly page: number;
|
|
91
|
-
readonly permalink: string;
|
|
92
|
-
readonly postsPerPage: number;
|
|
93
|
-
readonly previousPage?: string;
|
|
94
|
-
readonly totalCount: number;
|
|
95
|
-
readonly totalPages: number;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type Props = {
|
|
99
|
-
readonly sidebar: BlogSidebar;
|
|
100
|
-
readonly metadata: Metadata;
|
|
101
|
-
readonly items: readonly {readonly content: Content}[];
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const BlogListPage: (props: Props) => JSX.Element;
|
|
105
|
-
export default BlogListPage;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
declare module '@theme/BlogTagsListPage' {
|
|
109
|
-
import type {BlogSidebar} from '@theme/BlogSidebar';
|
|
110
|
-
|
|
111
|
-
export type Tag = {
|
|
112
|
-
permalink: string;
|
|
113
|
-
name: string;
|
|
114
|
-
count: number;
|
|
115
|
-
allTagsPath: string;
|
|
116
|
-
slug: string;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export type Props = {
|
|
120
|
-
readonly sidebar: BlogSidebar;
|
|
121
|
-
readonly tags: Readonly<Record<string, Tag>>;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const BlogTagsListPage: (props: Props) => JSX.Element;
|
|
125
|
-
export default BlogTagsListPage;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
declare module '@theme/BlogTagsPostsPage' {
|
|
129
|
-
import type {BlogSidebar} from '@theme/BlogSidebar';
|
|
130
|
-
import type {Tag} from '@theme/BlogTagsListPage';
|
|
131
|
-
import type {Content} from '@theme/BlogPostPage';
|
|
132
|
-
|
|
133
|
-
export type Props = {
|
|
134
|
-
readonly sidebar: BlogSidebar;
|
|
135
|
-
readonly metadata: Tag;
|
|
136
|
-
readonly items: readonly {readonly content: Content}[];
|
|
137
|
-
};
|
|
138
|
-
}
|