@docusaurus/plugin-content-blog 2.0.0-beta.ff31de0ff → 2.0.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.
Files changed (58) hide show
  1. package/lib/authors.d.ts +22 -0
  2. package/lib/authors.js +122 -0
  3. package/lib/blogUtils.d.ts +27 -7
  4. package/lib/blogUtils.js +214 -141
  5. package/lib/feed.d.ts +15 -0
  6. package/lib/feed.js +102 -0
  7. package/lib/frontMatter.d.ts +10 -0
  8. package/lib/frontMatter.js +62 -0
  9. package/lib/index.d.ts +4 -4
  10. package/lib/index.js +179 -205
  11. package/lib/markdownLoader.d.ts +3 -6
  12. package/lib/markdownLoader.js +6 -7
  13. package/lib/options.d.ts +10 -0
  14. package/lib/{pluginOptionSchema.js → options.js} +44 -14
  15. package/lib/remark/footnoteIDFixer.d.ts +14 -0
  16. package/lib/remark/footnoteIDFixer.js +29 -0
  17. package/lib/translations.d.ts +10 -0
  18. package/lib/translations.js +53 -0
  19. package/lib/types.d.ts +4 -109
  20. package/package.json +23 -18
  21. package/src/authors.ts +168 -0
  22. package/src/blogUtils.ts +316 -196
  23. package/src/feed.ts +171 -0
  24. package/src/frontMatter.ts +81 -0
  25. package/src/index.ts +246 -268
  26. package/src/markdownLoader.ts +11 -16
  27. package/src/{pluginOptionSchema.ts → options.ts} +57 -16
  28. package/src/plugin-content-blog.d.ts +587 -0
  29. package/src/remark/footnoteIDFixer.ts +29 -0
  30. package/src/translations.ts +69 -0
  31. package/src/types.ts +2 -128
  32. package/index.d.ts +0 -138
  33. package/lib/.tsbuildinfo +0 -4415
  34. package/lib/blogFrontMatter.d.ts +0 -28
  35. package/lib/blogFrontMatter.js +0 -50
  36. package/lib/pluginOptionSchema.d.ts +0 -33
  37. package/src/__tests__/__fixtures__/website/blog/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
  38. package/src/__tests__/__fixtures__/website/blog/complex-slug.md +0 -7
  39. package/src/__tests__/__fixtures__/website/blog/date-matter.md +0 -5
  40. package/src/__tests__/__fixtures__/website/blog/draft.md +0 -6
  41. package/src/__tests__/__fixtures__/website/blog/heading-as-title.md +0 -5
  42. package/src/__tests__/__fixtures__/website/blog/simple-slug.md +0 -7
  43. package/src/__tests__/__fixtures__/website/blog-with-ref/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
  44. package/src/__tests__/__fixtures__/website/blog-with-ref/post-with-broken-links.md +0 -11
  45. package/src/__tests__/__fixtures__/website/blog-with-ref/post.md +0 -5
  46. package/src/__tests__/__fixtures__/website/i18n/en/docusaurus-plugin-content-blog/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
  47. package/src/__tests__/__fixtures__/website-blog-without-date/blog/no date.md +0 -1
  48. package/src/__tests__/__snapshots__/generateBlogFeed.test.ts.snap +0 -101
  49. package/src/__tests__/__snapshots__/linkify.test.ts.snap +0 -24
  50. package/src/__tests__/__snapshots__/pluginOptionSchema.test.ts.snap +0 -5
  51. package/src/__tests__/blogFrontMatter.test.ts +0 -265
  52. package/src/__tests__/generateBlogFeed.test.ts +0 -100
  53. package/src/__tests__/index.test.ts +0 -336
  54. package/src/__tests__/linkify.test.ts +0 -93
  55. package/src/__tests__/pluginOptionSchema.test.ts +0 -150
  56. package/src/blogFrontMatter.ts +0 -87
  57. package/tsconfig.json +0 -9
  58. package/types.d.ts +0 -13
@@ -1,87 +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 camelcase */
9
-
10
- import {
11
- JoiFrontMatter as Joi, // Custom instance for frontmatter
12
- validateFrontMatter,
13
- } from '@docusaurus/utils-validation';
14
- import {Tag} from './types';
15
-
16
- export type BlogPostFrontMatter = {
17
- id?: string;
18
- title?: string;
19
- description?: string;
20
- tags?: (string | Tag)[];
21
- slug?: string;
22
- draft?: boolean;
23
- date?: Date;
24
-
25
- author?: string;
26
- author_title?: string;
27
- author_url?: string;
28
- author_image_url?: string;
29
-
30
- image?: string;
31
- keywords?: string[];
32
- hide_table_of_contents?: boolean;
33
-
34
- /** @deprecated */
35
- authorTitle?: string;
36
- authorURL?: string;
37
- authorImageURL?: string;
38
- };
39
-
40
- // NOTE: we don't add any default value on purpose here
41
- // We don't want default values to magically appear in doc metadatas and props
42
- // While the user did not provide those values explicitly
43
- // We use default values in code instead
44
- const BlogTagSchema = Joi.alternatives().try(
45
- Joi.string().required(),
46
- Joi.object<Tag>({
47
- label: Joi.string().required(),
48
- permalink: Joi.string().required(),
49
- }),
50
- );
51
-
52
- const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
53
- id: Joi.string(),
54
- title: Joi.string().allow(''),
55
- description: Joi.string().allow(''),
56
- tags: Joi.array().items(BlogTagSchema),
57
- draft: Joi.boolean(),
58
- date: Joi.date().raw(),
59
-
60
- author: Joi.string(),
61
- author_title: Joi.string(),
62
- author_url: Joi.string().uri(),
63
- author_image_url: Joi.string().uri(),
64
- slug: Joi.string(),
65
- image: Joi.string().uri({relativeOnly: true}),
66
- keywords: Joi.array().items(Joi.string().required()),
67
- hide_table_of_contents: Joi.boolean(),
68
-
69
- // TODO re-enable warnings later, our v1 blog posts use those older frontmatter fields
70
- authorURL: Joi.string().uri(),
71
- // .warning('deprecate.error', { alternative: '"author_url"'}),
72
- authorTitle: Joi.string(),
73
- // .warning('deprecate.error', { alternative: '"author_title"'}),
74
- authorImageURL: Joi.string().uri(),
75
- // .warning('deprecate.error', { alternative: '"author_image_url"'}),
76
- })
77
- .unknown()
78
- .messages({
79
- 'deprecate.error':
80
- '{#label} blog frontMatter field is deprecated. Please use {#alternative} instead.',
81
- });
82
-
83
- export function validateBlogPostFrontMatter(
84
- frontMatter: Record<string, unknown>,
85
- ): BlogPostFrontMatter {
86
- return validateFrontMatter(frontMatter, BlogFrontMatterSchema);
87
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "incremental": true,
5
- "tsBuildInfoFile": "./lib/.tsbuildinfo",
6
- "rootDir": "src",
7
- "outDir": "lib"
8
- }
9
- }
package/types.d.ts DELETED
@@ -1,13 +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
- declare module 'remark-admonitions' {
9
- type Options = Record<string, unknown>;
10
-
11
- const plugin: (options?: Options) => void;
12
- export = plugin;
13
- }