@docusaurus/plugin-content-blog 2.0.0-beta.13 → 2.0.0-beta.15

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 (76) hide show
  1. package/lib/authors.d.ts +5 -8
  2. package/lib/authors.js +15 -53
  3. package/lib/blogFrontMatter.d.ts +1 -34
  4. package/lib/blogFrontMatter.js +3 -3
  5. package/lib/blogUtils.d.ts +3 -3
  6. package/lib/blogUtils.js +28 -22
  7. package/lib/feed.d.ts +3 -8
  8. package/lib/feed.js +46 -35
  9. package/lib/index.d.ts +4 -3
  10. package/lib/index.js +33 -28
  11. package/lib/markdownLoader.d.ts +1 -1
  12. package/lib/markdownLoader.js +1 -2
  13. package/lib/pluginOptionSchema.d.ts +1 -1
  14. package/lib/pluginOptionSchema.js +5 -3
  15. package/lib/translations.d.ts +2 -1
  16. package/lib/translations.js +3 -3
  17. package/lib/types.d.ts +2 -79
  18. package/package.json +11 -12
  19. package/src/authors.ts +22 -69
  20. package/src/blogFrontMatter.ts +5 -50
  21. package/src/blogUtils.ts +38 -34
  22. package/src/feed.ts +80 -37
  23. package/src/index.ts +48 -44
  24. package/src/markdownLoader.ts +2 -3
  25. package/src/plugin-content-blog.d.ts +147 -4
  26. package/src/pluginOptionSchema.ts +7 -5
  27. package/src/translations.ts +5 -4
  28. package/src/types.ts +5 -97
  29. package/lib/.tsbuildinfo +0 -1
  30. package/src/__tests__/__fixtures__/authorsMapFiles/authors.json +0 -29
  31. package/src/__tests__/__fixtures__/authorsMapFiles/authors.yml +0 -27
  32. package/src/__tests__/__fixtures__/authorsMapFiles/authorsBad1.json +0 -5
  33. package/src/__tests__/__fixtures__/authorsMapFiles/authorsBad1.yml +0 -3
  34. package/src/__tests__/__fixtures__/authorsMapFiles/authorsBad2.json +0 -3
  35. package/src/__tests__/__fixtures__/authorsMapFiles/authorsBad2.yml +0 -2
  36. package/src/__tests__/__fixtures__/authorsMapFiles/authorsBad3.json +0 -8
  37. package/src/__tests__/__fixtures__/authorsMapFiles/authorsBad3.yml +0 -3
  38. package/src/__tests__/__fixtures__/component/Typography.tsx +0 -6
  39. package/src/__tests__/__fixtures__/getAuthorsMapFilePath/contentPathEmpty/empty +0 -0
  40. package/src/__tests__/__fixtures__/getAuthorsMapFilePath/contentPathJson1/authors.json +0 -0
  41. package/src/__tests__/__fixtures__/getAuthorsMapFilePath/contentPathJson2/authors.json +0 -0
  42. package/src/__tests__/__fixtures__/getAuthorsMapFilePath/contentPathNestedYml/sub/folder/authors.yml +0 -0
  43. package/src/__tests__/__fixtures__/getAuthorsMapFilePath/contentPathYml1/authors.yml +0 -0
  44. package/src/__tests__/__fixtures__/getAuthorsMapFilePath/contentPathYml2/authors.yml +0 -0
  45. package/src/__tests__/__fixtures__/website/blog/2018-12-14-Happy-First-Birthday-Slash.md +0 -8
  46. package/src/__tests__/__fixtures__/website/blog/_partials/somePartial.md +0 -3
  47. package/src/__tests__/__fixtures__/website/blog/_partials/subfolder/somePartial.md +0 -3
  48. package/src/__tests__/__fixtures__/website/blog/_somePartial.md +0 -3
  49. package/src/__tests__/__fixtures__/website/blog/authors.yml +0 -4
  50. package/src/__tests__/__fixtures__/website/blog/complex-slug.md +0 -7
  51. package/src/__tests__/__fixtures__/website/blog/date-matter.md +0 -5
  52. package/src/__tests__/__fixtures__/website/blog/draft.md +0 -6
  53. package/src/__tests__/__fixtures__/website/blog/heading-as-title.md +0 -5
  54. package/src/__tests__/__fixtures__/website/blog/mdx-blog-post.mdx +0 -36
  55. package/src/__tests__/__fixtures__/website/blog/mdx-require-blog-post.mdx +0 -14
  56. package/src/__tests__/__fixtures__/website/blog/simple-slug.md +0 -11
  57. package/src/__tests__/__fixtures__/website/blog-with-ref/2018-12-14-Happy-First-Birthday-Slash.md +0 -5
  58. package/src/__tests__/__fixtures__/website/blog-with-ref/post-with-broken-links.md +0 -11
  59. package/src/__tests__/__fixtures__/website/blog-with-ref/post.md +0 -5
  60. package/src/__tests__/__fixtures__/website/i18n/en/docusaurus-plugin-content-blog/2018-12-14-Happy-First-Birthday-Slash.md +0 -8
  61. package/src/__tests__/__fixtures__/website/i18n/en/docusaurus-plugin-content-blog/authors.yml +0 -5
  62. package/src/__tests__/__fixtures__/website/static/img/docusaurus.png +0 -0
  63. package/src/__tests__/__fixtures__/website-blog-without-date/blog/no date.md +0 -1
  64. package/src/__tests__/__snapshots__/feed.test.ts.snap +0 -164
  65. package/src/__tests__/__snapshots__/linkify.test.ts.snap +0 -24
  66. package/src/__tests__/__snapshots__/pluginOptionSchema.test.ts.snap +0 -5
  67. package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -64
  68. package/src/__tests__/authors.test.ts +0 -608
  69. package/src/__tests__/blogFrontMatter.test.ts +0 -394
  70. package/src/__tests__/blogUtils.test.ts +0 -94
  71. package/src/__tests__/feed.test.ts +0 -126
  72. package/src/__tests__/index.test.ts +0 -408
  73. package/src/__tests__/linkify.test.ts +0 -93
  74. package/src/__tests__/pluginOptionSchema.test.ts +0 -150
  75. package/src/__tests__/translations.test.ts +0 -92
  76. package/tsconfig.json +0 -9
@@ -1,164 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`blogFeed atom shows feed item for each post 1`] = `
4
- "<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
5
- <feed xmlns=\\"http://www.w3.org/2005/Atom\\">
6
- <id>https://docusaurus.io/myBaseUrl/blog</id>
7
- <title>Hello Blog</title>
8
- <updated>2021-03-06T00:00:00.000Z</updated>
9
- <generator>https://github.com/jpmonette/feed</generator>
10
- <link rel=\\"alternate\\" href=\\"https://docusaurus.io/myBaseUrl/blog\\"/>
11
- <subtitle>Hello Blog</subtitle>
12
- <icon>https://docusaurus.io/myBaseUrl/image/favicon.ico</icon>
13
- <rights>Copyright</rights>
14
- <entry>
15
- <title type=\\"html\\"><![CDATA[MDX Blog Sample with require calls]]></title>
16
- <id>/mdx-require-blog-post</id>
17
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post\\"/>
18
- <updated>2021-03-06T00:00:00.000Z</updated>
19
- <summary type=\\"html\\"><![CDATA[Test MDX with require calls]]></summary>
20
- </entry>
21
- <entry>
22
- <title type=\\"html\\"><![CDATA[Full Blog Sample]]></title>
23
- <id>/mdx-blog-post</id>
24
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/mdx-blog-post\\"/>
25
- <updated>2021-03-05T00:00:00.000Z</updated>
26
- <summary type=\\"html\\"><![CDATA[HTML Heading 1]]></summary>
27
- <content type=\\"html\\"><![CDATA[<h1>HTML Heading 1</h1><h2>HTML Heading 2</h2><p>HTML Paragraph</p><div>Import DOM</div><h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5><ul><li>list1</li><li>list2</li><li>list3</li></ul><ul><li>list1</li><li>list2</li><li>list3</li></ul><p>Normal Text <em>Italics Text</em> <strong>Bold Text</strong></p><p><a href=\\"https://v2.docusaurus.io/\\">link</a>
28
- <img src=\\"https://v2.docusaurus.io/\\" alt=\\"image\\"/></p>]]></content>
29
- </entry>
30
- <entry>
31
- <title type=\\"html\\"><![CDATA[Complex Slug]]></title>
32
- <id>/hey/my super path/héllô</id>
33
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô\\"/>
34
- <updated>2020-08-16T00:00:00.000Z</updated>
35
- <summary type=\\"html\\"><![CDATA[complex url slug]]></summary>
36
- <content type=\\"html\\"><![CDATA[<p>complex url slug</p>]]></content>
37
- </entry>
38
- <entry>
39
- <title type=\\"html\\"><![CDATA[Simple Slug]]></title>
40
- <id>/simple/slug</id>
41
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/simple/slug\\"/>
42
- <updated>2020-08-15T00:00:00.000Z</updated>
43
- <summary type=\\"html\\"><![CDATA[simple url slug]]></summary>
44
- <content type=\\"html\\"><![CDATA[<p>simple url slug</p>]]></content>
45
- <author>
46
- <name>Sébastien Lorber</name>
47
- <uri>https://sebastienlorber.com</uri>
48
- </author>
49
- </entry>
50
- <entry>
51
- <title type=\\"html\\"><![CDATA[draft]]></title>
52
- <id>/draft</id>
53
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/draft\\"/>
54
- <updated>2020-02-27T00:00:00.000Z</updated>
55
- <summary type=\\"html\\"><![CDATA[this post should not be published yet]]></summary>
56
- <content type=\\"html\\"><![CDATA[<p>this post should not be published yet</p>]]></content>
57
- </entry>
58
- <entry>
59
- <title type=\\"html\\"><![CDATA[some heading]]></title>
60
- <id>/heading-as-title</id>
61
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/heading-as-title\\"/>
62
- <updated>2019-01-02T00:00:00.000Z</updated>
63
- </entry>
64
- <entry>
65
- <title type=\\"html\\"><![CDATA[date-matter]]></title>
66
- <id>/date-matter</id>
67
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/date-matter\\"/>
68
- <updated>2019-01-01T00:00:00.000Z</updated>
69
- <summary type=\\"html\\"><![CDATA[date inside front matter]]></summary>
70
- <content type=\\"html\\"><![CDATA[<p>date inside front matter</p>]]></content>
71
- </entry>
72
- <entry>
73
- <title type=\\"html\\"><![CDATA[Happy 1st Birthday Slash! (translated)]]></title>
74
- <id>/2018/12/14/Happy-First-Birthday-Slash</id>
75
- <link href=\\"https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash\\"/>
76
- <updated>2018-12-14T00:00:00.000Z</updated>
77
- <summary type=\\"html\\"><![CDATA[Happy birthday! (translated)]]></summary>
78
- <content type=\\"html\\"><![CDATA[<p>Happy birthday! (translated)</p>]]></content>
79
- <author>
80
- <name>Yangshun Tay (translated)</name>
81
- </author>
82
- <author>
83
- <name>Sébastien Lorber (translated)</name>
84
- </author>
85
- </entry>
86
- </feed>"
87
- `;
88
-
89
- exports[`blogFeed rss shows feed item for each post 1`] = `
90
- "<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
91
- <rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\">
92
- <channel>
93
- <title>Hello Blog</title>
94
- <link>https://docusaurus.io/myBaseUrl/blog</link>
95
- <description>Hello Blog</description>
96
- <lastBuildDate>Sat, 06 Mar 2021 00:00:00 GMT</lastBuildDate>
97
- <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
98
- <generator>https://github.com/jpmonette/feed</generator>
99
- <copyright>Copyright</copyright>
100
- <item>
101
- <title><![CDATA[MDX Blog Sample with require calls]]></title>
102
- <link>https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post</link>
103
- <guid>/mdx-require-blog-post</guid>
104
- <pubDate>Sat, 06 Mar 2021 00:00:00 GMT</pubDate>
105
- <description><![CDATA[Test MDX with require calls]]></description>
106
- </item>
107
- <item>
108
- <title><![CDATA[Full Blog Sample]]></title>
109
- <link>https://docusaurus.io/myBaseUrl/blog/mdx-blog-post</link>
110
- <guid>/mdx-blog-post</guid>
111
- <pubDate>Fri, 05 Mar 2021 00:00:00 GMT</pubDate>
112
- <description><![CDATA[HTML Heading 1]]></description>
113
- <content:encoded><![CDATA[<h1>HTML Heading 1</h1><h2>HTML Heading 2</h2><p>HTML Paragraph</p><div>Import DOM</div><h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5><ul><li>list1</li><li>list2</li><li>list3</li></ul><ul><li>list1</li><li>list2</li><li>list3</li></ul><p>Normal Text <em>Italics Text</em> <strong>Bold Text</strong></p><p><a href=\\"https://v2.docusaurus.io/\\">link</a>
114
- <img src=\\"https://v2.docusaurus.io/\\" alt=\\"image\\"/></p>]]></content:encoded>
115
- </item>
116
- <item>
117
- <title><![CDATA[Complex Slug]]></title>
118
- <link>https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô</link>
119
- <guid>/hey/my super path/héllô</guid>
120
- <pubDate>Sun, 16 Aug 2020 00:00:00 GMT</pubDate>
121
- <description><![CDATA[complex url slug]]></description>
122
- <content:encoded><![CDATA[<p>complex url slug</p>]]></content:encoded>
123
- </item>
124
- <item>
125
- <title><![CDATA[Simple Slug]]></title>
126
- <link>https://docusaurus.io/myBaseUrl/blog/simple/slug</link>
127
- <guid>/simple/slug</guid>
128
- <pubDate>Sat, 15 Aug 2020 00:00:00 GMT</pubDate>
129
- <description><![CDATA[simple url slug]]></description>
130
- <content:encoded><![CDATA[<p>simple url slug</p>]]></content:encoded>
131
- </item>
132
- <item>
133
- <title><![CDATA[draft]]></title>
134
- <link>https://docusaurus.io/myBaseUrl/blog/draft</link>
135
- <guid>/draft</guid>
136
- <pubDate>Thu, 27 Feb 2020 00:00:00 GMT</pubDate>
137
- <description><![CDATA[this post should not be published yet]]></description>
138
- <content:encoded><![CDATA[<p>this post should not be published yet</p>]]></content:encoded>
139
- </item>
140
- <item>
141
- <title><![CDATA[some heading]]></title>
142
- <link>https://docusaurus.io/myBaseUrl/blog/heading-as-title</link>
143
- <guid>/heading-as-title</guid>
144
- <pubDate>Wed, 02 Jan 2019 00:00:00 GMT</pubDate>
145
- </item>
146
- <item>
147
- <title><![CDATA[date-matter]]></title>
148
- <link>https://docusaurus.io/myBaseUrl/blog/date-matter</link>
149
- <guid>/date-matter</guid>
150
- <pubDate>Tue, 01 Jan 2019 00:00:00 GMT</pubDate>
151
- <description><![CDATA[date inside front matter]]></description>
152
- <content:encoded><![CDATA[<p>date inside front matter</p>]]></content:encoded>
153
- </item>
154
- <item>
155
- <title><![CDATA[Happy 1st Birthday Slash! (translated)]]></title>
156
- <link>https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash</link>
157
- <guid>/2018/12/14/Happy-First-Birthday-Slash</guid>
158
- <pubDate>Fri, 14 Dec 2018 00:00:00 GMT</pubDate>
159
- <description><![CDATA[Happy birthday! (translated)]]></description>
160
- <content:encoded><![CDATA[<p>Happy birthday! (translated)</p>]]></content:encoded>
161
- </item>
162
- </channel>
163
- </rss>"
164
- `;
@@ -1,24 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`report broken markdown links 1`] = `
4
- "---
5
- title: This post links to another one!
6
- ---
7
-
8
- [Good link 1](/blog/2018/12/14/Happy-First-Birthday-Slash)
9
-
10
- [Good link 2](/blog/2018/12/14/Happy-First-Birthday-Slash)
11
-
12
- [Bad link 1](postNotExist1.md)
13
-
14
- [Bad link 1](./postNotExist2.mdx)
15
- "
16
- `;
17
-
18
- exports[`transform to correct link 1`] = `
19
- "---
20
- title: This post links to another one!
21
- ---
22
-
23
- [Linked post](/blog/2018/12/14/Happy-First-Birthday-Slash)"
24
- `;
@@ -1,5 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`should throw Error in case of invalid feedtype 1`] = `[ValidationError: "feedOptions.type" does not match any of the allowed types]`;
4
-
5
- exports[`should throw Error in case of invalid options 1`] = `[ValidationError: "postsPerPage" must be greater than or equal to 1]`;
@@ -1,64 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`getContentTranslationFiles should return translation files matching snapshot 1`] = `
4
- Array [
5
- Object {
6
- "content": Object {
7
- "description": Object {
8
- "description": "The description for the blog used in SEO",
9
- "message": "Someone's random blog",
10
- },
11
- "sidebar.title": Object {
12
- "description": "The label for the left sidebar",
13
- "message": "All my posts",
14
- },
15
- "title": Object {
16
- "description": "The title for the blog used in SEO",
17
- "message": "My blog",
18
- },
19
- },
20
- "path": "options",
21
- },
22
- ]
23
- `;
24
-
25
- exports[`translateContent should return translated loaded content matching snapshot 1`] = `
26
- Object {
27
- "blogListPaginated": Array [
28
- Object {
29
- "items": Array [
30
- "hello",
31
- ],
32
- "metadata": Object {
33
- "blogDescription": "Someone's random blog (translated)",
34
- "blogTitle": "My blog (translated)",
35
- "nextPage": null,
36
- "page": 1,
37
- "permalink": "/",
38
- "postsPerPage": 10,
39
- "previousPage": null,
40
- "totalCount": 1,
41
- "totalPages": 1,
42
- },
43
- },
44
- ],
45
- "blogPosts": Array [
46
- Object {
47
- "id": "hello",
48
- "metadata": Object {
49
- "date": 2021-07-19T00:00:00.000Z,
50
- "description": "/blog/2021/06/19/hello",
51
- "formattedDate": "June 19, 2021",
52
- "permalink": "/blog/2021/06/19/hello",
53
- "source": "/blog/2021/06/19/hello",
54
- "tags": Array [],
55
- "title": "Hello",
56
- "truncated": true,
57
- },
58
- },
59
- ],
60
- "blogSidebarTitle": "All my posts (translated)",
61
- "blogTags": Object {},
62
- "blogTagsListPath": "/tags",
63
- }
64
- `;