@docusaurus/plugin-content-blog 3.8.1-canary-6400 → 3.8.1-canary-6402

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.
@@ -23,6 +23,7 @@ exports.AuthorSocialsSchema = utils_validation_1.Joi.object({
23
23
  mastodon: utils_validation_1.Joi.string(),
24
24
  twitch: utils_validation_1.Joi.string(),
25
25
  youtube: utils_validation_1.Joi.string(),
26
+ email: utils_validation_1.Joi.string(),
26
27
  }).unknown();
27
28
  const PredefinedPlatformNormalizers = {
28
29
  x: (handle) => `https://x.com/${handle}`,
@@ -36,14 +37,16 @@ const PredefinedPlatformNormalizers = {
36
37
  mastodon: (handle) => `https://mastodon.social/@${handle}`, // can be in format user@other.server and it will redirect if needed
37
38
  twitch: (handle) => `https://twitch.tv/${handle}`,
38
39
  youtube: (handle) => `https://youtube.com/@${handle}`, // https://support.google.com/youtube/answer/6180214?hl=en
40
+ email: (email) => `mailto:${email}`,
39
41
  };
40
42
  function normalizeSocialEntry([platform, value]) {
41
- const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
42
43
  if (typeof value !== 'string') {
43
44
  throw new Error(`Author socials should be usernames/userIds/handles, or fully qualified HTTP(s) absolute URLs.
44
45
  Social platform '${platform}' has illegal value '${value}'`);
45
46
  }
46
- const isAbsoluteUrl = value.startsWith('http://') || value.startsWith('https://');
47
+ const isAbsoluteUrl = value.startsWith('http://') ||
48
+ value.startsWith('https://') ||
49
+ value.startsWith('mailto:');
47
50
  if (isAbsoluteUrl) {
48
51
  return [platform, value];
49
52
  }
@@ -51,6 +54,7 @@ Social platform '${platform}' has illegal value '${value}'`);
51
54
  throw new Error(`Author socials should be usernames/userIds/handles, or fully qualified HTTP(s) absolute URLs.
52
55
  Social platform '${platform}' has illegal value '${value}'`);
53
56
  }
57
+ const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
54
58
  if (normalizer && !isAbsoluteUrl) {
55
59
  const normalizedPlatform = platform.toLowerCase();
56
60
  const normalizedValue = normalizer(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "3.8.1-canary-6400",
3
+ "version": "3.8.1-canary-6402",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -31,14 +31,14 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@docusaurus/core": "3.8.1-canary-6400",
35
- "@docusaurus/logger": "3.8.1-canary-6400",
36
- "@docusaurus/mdx-loader": "3.8.1-canary-6400",
37
- "@docusaurus/theme-common": "3.8.1-canary-6400",
38
- "@docusaurus/types": "3.8.1-canary-6400",
39
- "@docusaurus/utils": "3.8.1-canary-6400",
40
- "@docusaurus/utils-common": "3.8.1-canary-6400",
41
- "@docusaurus/utils-validation": "3.8.1-canary-6400",
34
+ "@docusaurus/core": "3.8.1-canary-6402",
35
+ "@docusaurus/logger": "3.8.1-canary-6402",
36
+ "@docusaurus/mdx-loader": "3.8.1-canary-6402",
37
+ "@docusaurus/theme-common": "3.8.1-canary-6402",
38
+ "@docusaurus/types": "3.8.1-canary-6402",
39
+ "@docusaurus/utils": "3.8.1-canary-6402",
40
+ "@docusaurus/utils-common": "3.8.1-canary-6402",
41
+ "@docusaurus/utils-validation": "3.8.1-canary-6402",
42
42
  "cheerio": "1.0.0-rc.12",
43
43
  "feed": "^4.2.2",
44
44
  "fs-extra": "^11.1.1",
@@ -62,5 +62,5 @@
62
62
  "@total-typescript/shoehorn": "^0.1.2",
63
63
  "tree-node-cli": "^1.6.0"
64
64
  },
65
- "gitHead": "ba556e9a60021d91b91f3795fe3e647842ded5f6"
65
+ "gitHead": "d8576f8e307990a7f8350e753b3034d5e6de53d1"
66
66
  }
@@ -27,6 +27,7 @@ export const AuthorSocialsSchema = Joi.object<AuthorSocials>({
27
27
  mastodon: Joi.string(),
28
28
  twitch: Joi.string(),
29
29
  youtube: Joi.string(),
30
+ email: Joi.string(),
30
31
  }).unknown();
31
32
 
32
33
  type PredefinedPlatformNormalizer = (value: string) => string;
@@ -47,12 +48,12 @@ const PredefinedPlatformNormalizers: Record<
47
48
  mastodon: (handle: string) => `https://mastodon.social/@${handle}`, // can be in format user@other.server and it will redirect if needed
48
49
  twitch: (handle: string) => `https://twitch.tv/${handle}`,
49
50
  youtube: (handle: string) => `https://youtube.com/@${handle}`, // https://support.google.com/youtube/answer/6180214?hl=en
51
+ email: (email: string) => `mailto:${email}`,
50
52
  };
51
53
 
52
54
  type SocialEntry = [string, string];
53
55
 
54
56
  function normalizeSocialEntry([platform, value]: SocialEntry): SocialEntry {
55
- const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
56
57
  if (typeof value !== 'string') {
57
58
  throw new Error(
58
59
  `Author socials should be usernames/userIds/handles, or fully qualified HTTP(s) absolute URLs.
@@ -60,7 +61,9 @@ Social platform '${platform}' has illegal value '${value}'`,
60
61
  );
61
62
  }
62
63
  const isAbsoluteUrl =
63
- value.startsWith('http://') || value.startsWith('https://');
64
+ value.startsWith('http://') ||
65
+ value.startsWith('https://') ||
66
+ value.startsWith('mailto:');
64
67
  if (isAbsoluteUrl) {
65
68
  return [platform, value];
66
69
  } else if (value.includes('/')) {
@@ -69,6 +72,7 @@ Social platform '${platform}' has illegal value '${value}'`,
69
72
  Social platform '${platform}' has illegal value '${value}'`,
70
73
  );
71
74
  }
75
+ const normalizer = PredefinedPlatformNormalizers[platform.toLowerCase()];
72
76
  if (normalizer && !isAbsoluteUrl) {
73
77
  const normalizedPlatform = platform.toLowerCase();
74
78
  const normalizedValue = normalizer(value);