Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

feat: Add plugin to set image sizes in Markdown (#901)

Michael Manganiello62f61212600b
diff --git a/frontend/components/global/Markdown.vue b/frontend/components/global/Markdown.vue
index 3f61a03a..f0ff2f45 100644
--- a/frontend/components/global/Markdown.vue
+++ b/frontend/components/global/Markdown.vue
@@ -1,5 +1,6 @@
<script setup lang="ts">
import MarkdownIt from "markdown-it";
+ import { imgSize } from "@mdit/plugin-img-size";
import DOMPurify from "dompurify";
type Props = {
@@ -14,7 +15,7 @@
html: true,
linkify: true,
typographer: true,
- });
+ }).use(imgSize);
const raw = computed(() => {
const html = md.render(props.source || "").replace(/\n$/, ""); // remove trailing newline
diff --git a/frontend/package.json b/frontend/package.json
index 7311c1d2..8163cb88 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -19,7 +19,7 @@
"@intlify/unplugin-vue-i18n": "^4.0.0",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@playwright/test": "^1.52.0",
- "@types/markdown-it": "^13.0.9",
+ "@types/markdown-it": "^14.1.0",
"@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
@@ -44,6 +44,7 @@
"vue-tsc": "2.1.6"
},
"dependencies": {
+ "@mdit/plugin-img-size": "^0.22.2",
"@nuxtjs/color-mode": "^3.5.2",
"@nuxtjs/tailwindcss": "^6.13.2",
"@pinia/nuxt": "^0.5.5",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 46343396..54b96ce3 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -8,6 +8,9 @@ importers:
.:
dependencies:
+ '@mdit/plugin-img-size':
+ specifier: ^0.22.2
+ version: 0.22.2([email protected])
'@nuxtjs/color-mode':
specifier: ^3.5.2
version: 3.5.2([email protected])
@@ -124,8 +127,8 @@ importers:
specifier: ^1.52.0
version: 1.52.0
'@types/markdown-it':
- specifier: ^13.0.9
- version: 13.0.9
+ specifier: ^14.1.0
+ version: 14.1.2
'@types/semver':
specifier: ^7.7.0
version: 7.7.0
@@ -1530,6 +1533,15 @@ packages:
engines: {node: '>=18'}
hasBin: true
+ resolution: {integrity: sha512-+2+HpV5wZ3ZvFAs2alOiftDO635UbbOTr9uRQ0LZi/1lIZzKa0GE8sxYmtAZXRkdbGCj1uN6puoT7Bc7fdBs7Q==}
+ engines: {node: '>= 18'}
+ peerDependencies:
+ markdown-it: ^14.1.0
+ peerDependenciesMeta:
+ markdown-it:
+ optional: true
+
'@napi-rs/[email protected]':
resolution: {integrity: sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg==}
@@ -2051,14 +2063,14 @@ packages:
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
- '@types/[email protected]':
- resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==}
- '@types/[email protected]':
- resolution: {integrity: sha512-1XPwR0+MgXLWfTn9gCsZ55AHOKW1WN+P9vr0PaQh5aerR9LLQXUbjfEAFhjmEmyoYFWAyuN2Mqkn40MZ4ukjBw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==}
- '@types/[email protected]':
- resolution: {integrity: sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==}
resolution: {integrity: sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==}
@@ -8205,6 +8217,12 @@ snapshots:
- encoding
- supports-color
+ dependencies:
+ '@types/markdown-it': 14.1.2
+ optionalDependencies:
+ markdown-it: 14.1.0
+
'@napi-rs/[email protected]':
dependencies:
'@emnapi/core': 1.4.3
@@ -8551,7 +8569,7 @@ snapshots:
dependencies:
- '@nuxtjs/eslint-config': 12.0.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
'@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
'@typescript-eslint/parser': 6.21.0([email protected])([email protected])
eslint: 8.57.1
@@ -8564,10 +8582,10 @@ snapshots:
- supports-color
- typescript
dependencies:
eslint: 8.57.1
eslint-plugin-n: 15.7.0([email protected])
eslint-plugin-node: 11.1.0([email protected])
@@ -8949,14 +8967,14 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
+ '@types/[email protected]': {}
- '@types/[email protected]':
+ '@types/[email protected]':
dependencies:
- '@types/linkify-it': 3.0.5
- '@types/mdurl': 1.0.5
+ '@types/linkify-it': 5.0.0
+ '@types/mdurl': 2.0.0
- '@types/[email protected]': {}
+ '@types/[email protected]': {}
dependencies:
@@ -10655,7 +10673,7 @@ snapshots:
dependencies:
eslint: 8.57.1
dependencies:
eslint: 8.57.1
@@ -10685,7 +10703,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
@@ -10719,7 +10737,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
@@ -12293,7 +12311,7 @@ snapshots:
unenv: 1.10.0
unimport: 3.14.6([email protected])
unplugin: 1.16.1
untyped: 1.5.2
vue: 3.5.13([email protected])
@@ -13924,7 +13942,7 @@ snapshots:
pathe: 2.0.3
picomatch: 4.0.2
dependencies:
'@babel/types': 7.27.0
'@rollup/pluginutils': 5.1.4([email protected])
@@ -13941,7 +13959,7 @@ snapshots:
unplugin: 2.0.0-beta.1
yaml: 2.7.1
optionalDependencies:
transitivePeerDependencies:
- rollup
- vue