From da95679fcbd6d1a7922d136e348dfd21c792ed27 Mon Sep 17 00:00:00 2001 From: thuanbui Date: Tue, 17 Mar 2026 17:14:27 +0900 Subject: [PATCH] feat: add remark-unwrap-images for improved image handling --- astro.config.mjs | 2 ++ package-lock.json | 40 ++++++++++++++++------------------------ package.json | 1 + 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index ca221f0..132abf0 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -4,6 +4,7 @@ import mdx from "@astrojs/mdx"; import tailwindcss from "@tailwindcss/vite"; import icon from "astro-icon"; import remarkReadingTime from "remark-reading-time"; +import remarkUnwrapImages from "remark-unwrap-images"; import { remarkR2Images } from "./src/plugins/remark-r2-images.mjs"; import { rehypePictureWebp } from "./src/plugins/rehype-picture-webp.mjs"; @@ -20,6 +21,7 @@ export default defineConfig({ }; }, remarkR2Images, + remarkUnwrapImages, ], rehypePlugins: [rehypePictureWebp], }, diff --git a/package-lock.json b/package-lock.json index f500fb9..4049a90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "astro": "^6.0.4", "astro-icon": "^1.1.5", "remark-reading-time": "^2.0.2", + "remark-unwrap-images": "^4.0.1", "tailwindcss": "^4.1.18", "typescript": "^5.9.3", "unist-util-visit": "^5.1.0" @@ -1299,7 +1300,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1322,7 +1322,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1345,7 +1344,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1362,7 +1360,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1379,7 +1376,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1396,7 +1392,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1413,7 +1408,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1430,7 +1424,6 @@ "cpu": [ "riscv64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1447,7 +1440,6 @@ "cpu": [ "s390x" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1464,7 +1456,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1481,7 +1472,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1498,7 +1488,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1515,7 +1504,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1538,7 +1526,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1561,7 +1548,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1584,7 +1570,6 @@ "cpu": [ "riscv64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1607,7 +1592,6 @@ "cpu": [ "s390x" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1630,7 +1614,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1653,7 +1636,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1676,7 +1658,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "Apache-2.0", "optional": true, "os": [ @@ -1699,7 +1680,6 @@ "cpu": [ "wasm32" ], - "dev": true, "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", "optional": true, "dependencies": { @@ -1719,7 +1699,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "Apache-2.0 AND LGPL-3.0-or-later", "optional": true, "os": [ @@ -1739,7 +1718,6 @@ "cpu": [ "ia32" ], - "dev": true, "license": "Apache-2.0 AND LGPL-3.0-or-later", "optional": true, "os": [ @@ -1759,7 +1737,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "Apache-2.0 AND LGPL-3.0-or-later", "optional": true, "os": [ @@ -9880,6 +9857,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-unwrap-images": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-unwrap-images/-/remark-unwrap-images-4.0.1.tgz", + "integrity": "sha512-J9HibCHx0/X7ovgqaFe0otizCHpbb1s6Jh3IeiD5ibQm2Oz/OhCDXSKMEW5T54iBw5CxuqRL6BrYp+jLLdqBOw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "hast-util-whitespace": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/request-light": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/request-light/-/request-light-0.7.0.tgz", diff --git a/package.json b/package.json index dd5c832..5678e80 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "astro": "^6.0.4", "astro-icon": "^1.1.5", "remark-reading-time": "^2.0.2", + "remark-unwrap-images": "^4.0.1", "tailwindcss": "^4.1.18", "typescript": "^5.9.3", "unist-util-visit": "^5.1.0"