Skip to content

Commit 0ccba72

Browse files
committed
fix: processHtmlImages 함수에서 속성 검사 코드 정리
1 parent 51fd4d5 commit 0ccba72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.vitepress/plugins/markdown-picture.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ function processHtmlImages(html: string, markdownPath: string): string {
100100
const imgRegex = /<img\s+([^>]*?)\/?>/gi;
101101

102102
return html.replace(imgRegex, (match, attrs) => {
103-
if (!attrs || typeof attrs !== 'string') return match;
104-
103+
if (!attrs || typeof attrs !== "string") return match;
104+
105105
// src 속성 추출
106106
const srcMatch = /src=["']([^"']+)["']/i.exec(attrs);
107107
if (!srcMatch) return match;
@@ -118,7 +118,7 @@ function processHtmlImages(html: string, markdownPath: string): string {
118118
.replace(/alt=["'][^"']*["']/gi, "")
119119
.replace(/loading=["'][^"']*["']/gi, "") // loading은 우리가 추가할 것이므로 제거
120120
.trim();
121-
121+
122122
// 속성이 비어있거나 공백만 있으면 빈 문자열로
123123
if (!remainingAttrs || /^\s*$/.test(remainingAttrs)) {
124124
remainingAttrs = "";

0 commit comments

Comments
 (0)