-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] 이미지 대체텍스트 렌더링 기능 추가 #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -42,6 +42,42 @@ const PostBody = ({ content, tags, loading }: Props) => { | |||
| } | ||||
| }; | ||||
|
|
||||
| const addDescriptionUnderImage = ( | ||||
| node: any, | ||||
| index?: number, | ||||
| parent?: Element | ||||
| ) => { | ||||
| if (node.type === 'element' && node.tagName === 'img') { | ||||
| const altText = node.properties.alt; | ||||
| if (altText) { | ||||
| const descriptionNode = { | ||||
| type: 'element', | ||||
| tagName: 'span', | ||||
| properties: { | ||||
| className: 'image-description', | ||||
| }, | ||||
| children: [ | ||||
| { | ||||
| type: 'text', | ||||
| value: altText, | ||||
| }, | ||||
| ], | ||||
| }; | ||||
|
|
||||
| if ( | ||||
| index !== undefined && | ||||
| parent && | ||||
| parent.children && | ||||
| Array.isArray(parent.children) | ||||
| ) { | ||||
| parent.children.splice(index + 1, 0, descriptionNode); | ||||
| } | ||||
| } | ||||
| } | ||||
|
|
||||
| return null; | ||||
|
||||
| return null; |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,13 +82,21 @@ article.post .post-body p:has(img) { | |||||||
| } | ||||||||
|
|
||||||||
| article.post .post-body img { | ||||||||
| max-width: 100%; | ||||||||
| max-width: 90%; | ||||||||
| height: auto; | ||||||||
| margin: 1em 0; | ||||||||
| border-radius: 1em; | ||||||||
| box-shadow: 0 0 4px rgba(0, 0, 0, 0.05); | ||||||||
| } | ||||||||
|
|
||||||||
| article.post .post-body div > div img { | ||||||||
| max-width: 50%; | ||||||||
| } | ||||||||
|
|
||||||||
| article.post .post-body div > div.zoomBox img { | ||||||||
| max-width: 100%; | ||||||||
| } | ||||||||
|
Comment on lines
+96
to
+98
|
||||||||
| article.post .post-body div > div.zoomBox img { | |
| max-width: 100%; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dynamic class name construction with template literals can lead to CSS injection vulnerabilities. Consider using a predefined map of allowed maxWidth values or sanitizing the input.