File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,11 @@ function convertImgToPicture(
5252 additionalAttrs : string = "" ,
5353) : string {
5454 const safeAlt = alt || "" ;
55+ const safeAttrs = additionalAttrs && additionalAttrs . trim ( ) ? " " + additionalAttrs . trim ( ) : "" ;
5556
5657 // 외부 URL이거나 svg, gif는 picture 태그로 변환하지 않음
5758 if ( src . startsWith ( "http" ) || src . endsWith ( ".svg" ) || src . endsWith ( ".gif" ) ) {
58- return `<img src="${ src } " alt="${ safeAlt } "${ additionalAttrs ? " " + additionalAttrs : "" } loading="lazy" />` ;
59+ return `<img src="${ src } " alt="${ safeAlt } "${ safeAttrs } loading="lazy" />` ;
5960 }
6061
6162 // 이미지 포맷별 경로 생성
@@ -81,13 +82,13 @@ function convertImgToPicture(
8182
8283 // 변환된 이미지가 없으면 원본만 사용
8384 if ( sources . length === 0 ) {
84- return `<img src="${ src } " alt="${ safeAlt } "${ additionalAttrs ? " " + additionalAttrs : "" } loading="lazy" />` ;
85+ return `<img src="${ src } " alt="${ safeAlt } "${ safeAttrs } loading="lazy" />` ;
8586 }
8687
8788 // picture 태그 생성 (원본을 최종 fallback으로 사용)
8889 return `<picture>
8990 ${ sources . join ( "\n " ) }
90- <img src="${ src } " alt="${ safeAlt } "${ additionalAttrs ? " " + additionalAttrs : "" } loading="lazy" />
91+ <img src="${ src } " alt="${ safeAlt } "${ safeAttrs } loading="lazy" />
9192</picture>` ;
9293}
9394
You can’t perform that action at this time.
0 commit comments