-
diff --git a/app/entities/post/detail/PostBody.tsx b/app/entities/post/detail/PostBody.tsx
index 5a654ef..707a997 100644
--- a/app/entities/post/detail/PostBody.tsx
+++ b/app/entities/post/detail/PostBody.tsx
@@ -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;
+ };
+
const renderOpenGraph = (node: any, index?: number, parent?: Element) => {
if (node.type === 'element' && node.tagName === 'p' && node.children) {
const aTag = node.children.find(
@@ -226,7 +262,11 @@ const PostBody = ({ content, tags, loading }: Props) => {
) : (
<>
-