@docusaurus/plugin-content-blog 0.0.0-4945 → 0.0.0-4946
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/blogUtils.d.ts +2 -2
- package/lib/feed.d.ts +1 -2
- package/lib/index.d.ts +1 -2
- package/lib/translations.d.ts +1 -2
- package/lib/types.d.ts +1 -28
- package/package.json +9 -9
- package/src/blogUtils.ts +4 -7
- package/src/feed.ts +1 -1
- package/src/index.ts +5 -8
- package/src/plugin-content-blog.d.ts +67 -26
- package/src/translations.ts +5 -2
- package/src/types.ts +1 -33
package/lib/blogUtils.d.ts
CHANGED
|
@@ -4,9 +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 {
|
|
7
|
+
import type { BlogContentPaths, BlogMarkdownLoaderOptions } from './types';
|
|
8
8
|
import type { LoadContext } from '@docusaurus/types';
|
|
9
|
-
import type { PluginOptions } from '@docusaurus/plugin-content-blog';
|
|
9
|
+
import type { PluginOptions, BlogPost, BlogTags, BlogPaginated } from '@docusaurus/plugin-content-blog';
|
|
10
10
|
export declare function truncate(fileString: string, truncateMarker: RegExp): string;
|
|
11
11
|
export declare function getSourceToPermalink(blogPosts: BlogPost[]): {
|
|
12
12
|
[aliasedPath: string]: string;
|
package/lib/feed.d.ts
CHANGED
|
@@ -4,9 +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 { BlogPost } from './types';
|
|
8
7
|
import type { DocusaurusConfig } from '@docusaurus/types';
|
|
9
|
-
import type { PluginOptions } from '@docusaurus/plugin-content-blog';
|
|
8
|
+
import type { PluginOptions, BlogPost } from '@docusaurus/plugin-content-blog';
|
|
10
9
|
export declare function createBlogFeedFiles({ blogPosts, options, siteConfig, outDir, locale, }: {
|
|
11
10
|
blogPosts: BlogPost[];
|
|
12
11
|
options: PluginOptions;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
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 } from './types';
|
|
8
7
|
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
9
|
-
import type { PluginOptions } from '@docusaurus/plugin-content-blog';
|
|
8
|
+
import type { PluginOptions, BlogContent } from '@docusaurus/plugin-content-blog';
|
|
10
9
|
export default function pluginContentBlog(context: LoadContext, options: PluginOptions): Promise<Plugin<BlogContent>>;
|
|
11
10
|
export { validateOptions } from './options';
|
package/lib/translations.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
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 } from './types';
|
|
8
7
|
import type { TranslationFile } from '@docusaurus/types';
|
|
9
|
-
import type { PluginOptions } from '@docusaurus/plugin-content-blog';
|
|
8
|
+
import type { PluginOptions, BlogContent } from '@docusaurus/plugin-content-blog';
|
|
10
9
|
export declare function getTranslationFiles(options: PluginOptions): TranslationFile[];
|
|
11
10
|
export declare function translateContent(content: BlogContent, translationFiles: TranslationFile[]): BlogContent;
|
package/lib/types.d.ts
CHANGED
|
@@ -4,35 +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 { BrokenMarkdownLink, ContentPaths
|
|
8
|
-
import type { BlogPostMetadata } from '@docusaurus/plugin-content-blog';
|
|
9
|
-
import type { Metadata as BlogPaginatedMetadata } from '@theme/BlogListPage';
|
|
7
|
+
import type { BrokenMarkdownLink, ContentPaths } from '@docusaurus/utils';
|
|
10
8
|
export declare type BlogContentPaths = ContentPaths;
|
|
11
|
-
export declare type BlogContent = {
|
|
12
|
-
blogSidebarTitle: string;
|
|
13
|
-
blogPosts: BlogPost[];
|
|
14
|
-
blogListPaginated: BlogPaginated[];
|
|
15
|
-
blogTags: BlogTags;
|
|
16
|
-
blogTagsListPath: string;
|
|
17
|
-
};
|
|
18
|
-
export declare type BlogTags = {
|
|
19
|
-
[permalink: string]: BlogTag;
|
|
20
|
-
};
|
|
21
|
-
export declare type BlogTag = Tag & {
|
|
22
|
-
/** Blog post permalinks. */
|
|
23
|
-
items: string[];
|
|
24
|
-
pages: BlogPaginated[];
|
|
25
|
-
};
|
|
26
|
-
export declare type BlogPost = {
|
|
27
|
-
id: string;
|
|
28
|
-
metadata: BlogPostMetadata;
|
|
29
|
-
content: string;
|
|
30
|
-
};
|
|
31
|
-
export declare type BlogPaginated = {
|
|
32
|
-
metadata: BlogPaginatedMetadata;
|
|
33
|
-
/** Blog post permalinks. */
|
|
34
|
-
items: string[];
|
|
35
|
-
};
|
|
36
9
|
export declare type BlogBrokenMarkdownLink = BrokenMarkdownLink<BlogContentPaths>;
|
|
37
10
|
export declare type BlogMarkdownLoaderOptions = {
|
|
38
11
|
siteDir: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-blog",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4946",
|
|
4
4
|
"description": "Blog plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-blog.d.ts",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
26
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4946",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4946",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4946",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4946",
|
|
25
|
+
"@docusaurus/utils-common": "0.0.0-4946",
|
|
26
|
+
"@docusaurus/utils-validation": "0.0.0-4946",
|
|
27
27
|
"cheerio": "^1.0.0-rc.10",
|
|
28
28
|
"feed": "^4.2.2",
|
|
29
29
|
"fs-extra": "^10.1.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"webpack": "^5.72.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@docusaurus/types": "0.0.0-
|
|
39
|
+
"@docusaurus/types": "0.0.0-4946",
|
|
40
40
|
"escape-string-regexp": "^4.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=14"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "01073ce535af35aa33c1b221e2adb99ac993d589"
|
|
50
50
|
}
|
package/src/blogUtils.ts
CHANGED
|
@@ -9,13 +9,7 @@ import fs from 'fs-extra';
|
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import readingTime from 'reading-time';
|
|
11
11
|
import _ from 'lodash';
|
|
12
|
-
import type {
|
|
13
|
-
BlogPost,
|
|
14
|
-
BlogContentPaths,
|
|
15
|
-
BlogMarkdownLoaderOptions,
|
|
16
|
-
BlogTags,
|
|
17
|
-
BlogPaginated,
|
|
18
|
-
} from './types';
|
|
12
|
+
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
|
19
13
|
import {
|
|
20
14
|
parseMarkdownString,
|
|
21
15
|
normalizeUrl,
|
|
@@ -37,6 +31,9 @@ import logger from '@docusaurus/logger';
|
|
|
37
31
|
import type {
|
|
38
32
|
PluginOptions,
|
|
39
33
|
ReadingTimeFunction,
|
|
34
|
+
BlogPost,
|
|
35
|
+
BlogTags,
|
|
36
|
+
BlogPaginated,
|
|
40
37
|
} from '@docusaurus/plugin-content-blog';
|
|
41
38
|
|
|
42
39
|
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
package/src/feed.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
|
9
|
-
import type {BlogPost} from './types';
|
|
10
9
|
import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
|
|
11
10
|
import {load as cheerioLoad} from 'cheerio';
|
|
12
11
|
import type {DocusaurusConfig} from '@docusaurus/types';
|
|
@@ -16,6 +15,7 @@ import type {
|
|
|
16
15
|
FeedType,
|
|
17
16
|
PluginOptions,
|
|
18
17
|
Author,
|
|
18
|
+
BlogPost,
|
|
19
19
|
} from '@docusaurus/plugin-content-blog';
|
|
20
20
|
import {blogPostContainerID} from '@docusaurus/utils-common';
|
|
21
21
|
|
package/src/index.ts
CHANGED
|
@@ -25,14 +25,7 @@ import {
|
|
|
25
25
|
} from '@docusaurus/utils';
|
|
26
26
|
import {translateContent, getTranslationFiles} from './translations';
|
|
27
27
|
|
|
28
|
-
import type {
|
|
29
|
-
BlogTag,
|
|
30
|
-
BlogTags,
|
|
31
|
-
BlogContent,
|
|
32
|
-
BlogPaginated,
|
|
33
|
-
BlogContentPaths,
|
|
34
|
-
BlogMarkdownLoaderOptions,
|
|
35
|
-
} from './types';
|
|
28
|
+
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
|
36
29
|
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
|
|
37
30
|
import {
|
|
38
31
|
generateBlogPosts,
|
|
@@ -46,6 +39,10 @@ import type {
|
|
|
46
39
|
BlogPostFrontMatter,
|
|
47
40
|
BlogPostMetadata,
|
|
48
41
|
Assets,
|
|
42
|
+
BlogTag,
|
|
43
|
+
BlogTags,
|
|
44
|
+
BlogContent,
|
|
45
|
+
BlogPaginated,
|
|
49
46
|
} from '@docusaurus/plugin-content-blog';
|
|
50
47
|
|
|
51
48
|
export default async function pluginContentBlog(
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
declare module '@docusaurus/plugin-content-blog' {
|
|
9
9
|
import type {MDXOptions} from '@docusaurus/mdx-loader';
|
|
10
10
|
import type {FrontMatterTag, Tag} from '@docusaurus/utils';
|
|
11
|
+
import type {Plugin, LoadContext} from '@docusaurus/types';
|
|
11
12
|
import type {Overwrite} from 'utility-types';
|
|
12
13
|
|
|
13
14
|
export type Assets = {
|
|
@@ -410,6 +411,62 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
410
411
|
title: string;
|
|
411
412
|
items: {title: string; permalink: string}[];
|
|
412
413
|
};
|
|
414
|
+
|
|
415
|
+
export type BlogContent = {
|
|
416
|
+
blogSidebarTitle: string;
|
|
417
|
+
blogPosts: BlogPost[];
|
|
418
|
+
blogListPaginated: BlogPaginated[];
|
|
419
|
+
blogTags: BlogTags;
|
|
420
|
+
blogTagsListPath: string;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
export type BlogTags = {
|
|
424
|
+
[permalink: string]: BlogTag;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export type BlogTag = Tag & {
|
|
428
|
+
/** Blog post permalinks. */
|
|
429
|
+
items: string[];
|
|
430
|
+
pages: BlogPaginated[];
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
export type BlogPost = {
|
|
434
|
+
id: string;
|
|
435
|
+
metadata: BlogPostMetadata;
|
|
436
|
+
content: string;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
export type BlogPaginatedMetadata = {
|
|
440
|
+
/** Title of the entire blog. */
|
|
441
|
+
readonly blogTitle: string;
|
|
442
|
+
/** Blog description. */
|
|
443
|
+
readonly blogDescription: string;
|
|
444
|
+
/** Permalink to the next list page. */
|
|
445
|
+
readonly nextPage?: string;
|
|
446
|
+
/** Permalink of the current page. */
|
|
447
|
+
readonly permalink: string;
|
|
448
|
+
/** Permalink to the previous list page. */
|
|
449
|
+
readonly previousPage?: string;
|
|
450
|
+
/** Index of the current page, 1-based. */
|
|
451
|
+
readonly page: number;
|
|
452
|
+
/** Posts displayed on each list page. */
|
|
453
|
+
readonly postsPerPage: number;
|
|
454
|
+
/** Total number of posts in the entire blog. */
|
|
455
|
+
readonly totalCount: number;
|
|
456
|
+
/** Total number of list pages. */
|
|
457
|
+
readonly totalPages: number;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
export type BlogPaginated = {
|
|
461
|
+
metadata: BlogPaginatedMetadata;
|
|
462
|
+
/** Blog post permalinks. */
|
|
463
|
+
items: string[];
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
export default function pluginContentBlog(
|
|
467
|
+
context: LoadContext,
|
|
468
|
+
options: PluginOptions,
|
|
469
|
+
): Promise<Plugin<BlogContent>>;
|
|
413
470
|
}
|
|
414
471
|
|
|
415
472
|
declare module '@theme/BlogPostPage' {
|
|
@@ -446,34 +503,16 @@ declare module '@theme/BlogPostPage' {
|
|
|
446
503
|
|
|
447
504
|
declare module '@theme/BlogListPage' {
|
|
448
505
|
import type {Content} from '@theme/BlogPostPage';
|
|
449
|
-
import type {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
readonly blogTitle: string;
|
|
454
|
-
/** Blog description. */
|
|
455
|
-
readonly blogDescription: string;
|
|
456
|
-
/** Permalink to the next list page. */
|
|
457
|
-
readonly nextPage?: string;
|
|
458
|
-
/** Permalink of the current page. */
|
|
459
|
-
readonly permalink: string;
|
|
460
|
-
/** Permalink to the previous list page. */
|
|
461
|
-
readonly previousPage?: string;
|
|
462
|
-
/** Index of the current page, 1-based. */
|
|
463
|
-
readonly page: number;
|
|
464
|
-
/** Posts displayed on each list page. */
|
|
465
|
-
readonly postsPerPage: number;
|
|
466
|
-
/** Total number of posts in the entire blog. */
|
|
467
|
-
readonly totalCount: number;
|
|
468
|
-
/** Total number of list pages. */
|
|
469
|
-
readonly totalPages: number;
|
|
470
|
-
};
|
|
506
|
+
import type {
|
|
507
|
+
BlogSidebar,
|
|
508
|
+
BlogPaginatedMetadata,
|
|
509
|
+
} from '@docusaurus/plugin-content-blog';
|
|
471
510
|
|
|
472
511
|
export interface Props {
|
|
473
512
|
/** Blog sidebar. */
|
|
474
513
|
readonly sidebar: BlogSidebar;
|
|
475
514
|
/** Metadata of the current listing page. */
|
|
476
|
-
readonly metadata:
|
|
515
|
+
readonly metadata: BlogPaginatedMetadata;
|
|
477
516
|
/**
|
|
478
517
|
* Array of blog posts included on this page. Every post's metadata is also
|
|
479
518
|
* available.
|
|
@@ -499,9 +538,11 @@ declare module '@theme/BlogTagsListPage' {
|
|
|
499
538
|
}
|
|
500
539
|
|
|
501
540
|
declare module '@theme/BlogTagsPostsPage' {
|
|
502
|
-
import type {
|
|
541
|
+
import type {
|
|
542
|
+
BlogSidebar,
|
|
543
|
+
BlogPaginatedMetadata,
|
|
544
|
+
} from '@docusaurus/plugin-content-blog';
|
|
503
545
|
import type {Content} from '@theme/BlogPostPage';
|
|
504
|
-
import type {Metadata} from '@theme/BlogListPage';
|
|
505
546
|
import type {TagModule} from '@docusaurus/utils';
|
|
506
547
|
|
|
507
548
|
export interface Props {
|
|
@@ -510,7 +551,7 @@ declare module '@theme/BlogTagsPostsPage' {
|
|
|
510
551
|
/** Metadata of this tag. */
|
|
511
552
|
readonly tag: TagModule;
|
|
512
553
|
/** Looks exactly the same as the posts list page */
|
|
513
|
-
readonly listMetadata:
|
|
554
|
+
readonly listMetadata: BlogPaginatedMetadata;
|
|
514
555
|
/**
|
|
515
556
|
* Array of blog posts included on this page. Every post's metadata is also
|
|
516
557
|
* available.
|
package/src/translations.ts
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {BlogContent, BlogPaginated} from './types';
|
|
9
8
|
import type {TranslationFileContent, TranslationFile} from '@docusaurus/types';
|
|
10
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
PluginOptions,
|
|
11
|
+
BlogContent,
|
|
12
|
+
BlogPaginated,
|
|
13
|
+
} from '@docusaurus/plugin-content-blog';
|
|
11
14
|
|
|
12
15
|
function translateListPage(
|
|
13
16
|
blogListPaginated: BlogPaginated[],
|
package/src/types.ts
CHANGED
|
@@ -5,42 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {BrokenMarkdownLink, ContentPaths
|
|
9
|
-
import type {BlogPostMetadata} from '@docusaurus/plugin-content-blog';
|
|
10
|
-
import type {Metadata as BlogPaginatedMetadata} from '@theme/BlogListPage';
|
|
8
|
+
import type {BrokenMarkdownLink, ContentPaths} from '@docusaurus/utils';
|
|
11
9
|
|
|
12
10
|
export type BlogContentPaths = ContentPaths;
|
|
13
11
|
|
|
14
|
-
export type BlogContent = {
|
|
15
|
-
blogSidebarTitle: string;
|
|
16
|
-
blogPosts: BlogPost[];
|
|
17
|
-
blogListPaginated: BlogPaginated[];
|
|
18
|
-
blogTags: BlogTags;
|
|
19
|
-
blogTagsListPath: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type BlogTags = {
|
|
23
|
-
[permalink: string]: BlogTag;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type BlogTag = Tag & {
|
|
27
|
-
/** Blog post permalinks. */
|
|
28
|
-
items: string[];
|
|
29
|
-
pages: BlogPaginated[];
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type BlogPost = {
|
|
33
|
-
id: string;
|
|
34
|
-
metadata: BlogPostMetadata;
|
|
35
|
-
content: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type BlogPaginated = {
|
|
39
|
-
metadata: BlogPaginatedMetadata;
|
|
40
|
-
/** Blog post permalinks. */
|
|
41
|
-
items: string[];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
12
|
export type BlogBrokenMarkdownLink = BrokenMarkdownLink<BlogContentPaths>;
|
|
45
13
|
export type BlogMarkdownLoaderOptions = {
|
|
46
14
|
siteDir: string;
|