diff --git a/src/utils/image.ts b/src/utils/image.ts
index 987ea03..e1465f1 100644
--- a/src/utils/image.ts
+++ b/src/utils/image.ts
@@ -75,16 +75,19 @@ const render = (
parameters.packageManager = packageManager(config);
parameters.packageName = packageName(config.package);
- parameters.title = config.data?.title || "";
- parameters.description = config.data?.description || "";
-
parameters.images = detectIcon(config.image, packageData);
+ url = url
+ .replace("{title}", encodeUri(config.data?.title || ""))
+ .replace("{description}", encodeUri(config.data?.description || ""));
+
for (const [key, value] of Object.entries(parameters)) {
url = url.replace(`{${key}}`, encodeUri(value));
}
- return `${url}?${(new URLSearchParams(parameters)).toString()}`;
+ const query: string = new URLSearchParams(parameters).toString();
+
+ return `${url}?${query}`;
};
export const getImages = (config: Config, packageData: LockFile): string => {
diff --git a/tests/unit/__snapshots__/preview.test.ts.snap b/tests/unit/__snapshots__/preview.test.ts.snap
index fb69bd6..3152e0a 100644
--- a/tests/unit/__snapshots__/preview.test.ts.snap
+++ b/tests/unit/__snapshots__/preview.test.ts.snap
@@ -4,8 +4,8 @@ exports[`custom config 1`] = `
"# Some Title
-
-
+
+
Something
@@ -16,8 +16,8 @@ exports[`custom config 2`] = `
"# Some Title
-
-
+
+
Something
@@ -28,8 +28,8 @@ exports[`custom config 3`] = `
"# Some Title
-
-
+
+
Something
@@ -40,8 +40,8 @@ exports[`custom config 4`] = `
"# Some Title
-
-
+
+
Something
@@ -52,8 +52,8 @@ exports[`custom config 5`] = `
"# Some Title
-
-
+
+
Something
@@ -64,8 +64,8 @@ exports[`custom config 6`] = `
"# Some Title
-
-
+
+
Something
@@ -76,8 +76,8 @@ exports[`custom config 7`] = `
"# Some Title
-
-
+
+
Something
@@ -88,8 +88,8 @@ exports[`custom config 8`] = `
"# Some Title
-
-
+
+
Something
@@ -100,8 +100,8 @@ exports[`default config 1`] = `
"# Some Title
-
-
+
+
"
@@ -111,8 +111,8 @@ exports[`default config 2`] = `
"# Some Title
-
-
+
+
Something
@@ -123,8 +123,8 @@ exports[`default config 3`] = `
"# Preview Updater
-
-
+
+
## Usage
@@ -137,8 +137,8 @@ exports[`default config 4`] = `
"# Some Title
-
-
+
+
## Usage
@@ -151,8 +151,8 @@ exports[`default config 5`] = `
"# Preview Updater
-
-
+
+
## Usage
@@ -165,8 +165,8 @@ exports[`default config 6`] = `
"# Some Title
-
-
+
+
## Usage
@@ -179,8 +179,8 @@ exports[`default config 7`] = `
"# Some Title
-
-
+
+
## Usage
@@ -193,8 +193,8 @@ exports[`default config 8`] = `
"# Preview Updater
-
-
+
+
## Usage
@@ -207,8 +207,8 @@ exports[`default config 9`] = `
"# Preview Updater
-
-
+
+
## Usage