--- import type { Post } from '@/types'; import { processImagesForLightbox, getOptimizedFormat } from '@/utils/images'; import { siteConfig } from '@/config'; import { formatDate, formatDateMobile, getReadingTimeMobile } from '@/utils/markdown'; import ImageGallery from './ImageGallery.astro'; import TableOfContents from './TableOfContents.astro'; import Button from './Button.astro'; import ImageWrapper from './ImageWrapper.astro'; export interface Props { post: Post & { Content: any; toc: any[]; readingTime?: any; wordCount?: number; }; } const { post } = Astro.props; const { Content, toc, readingTime, wordCount } = post; // Process Obsidian bracket syntax in image field const processedImage = (() => { if (!post.data.image) return post.data.image; // Handle case where image is an array (unquoted YAML syntax) let imageValue = post.data.image; if (Array.isArray(post.data.image)) { // If it's an array, take the first element imageValue = post.data.image[0]; } // Ensure imageValue is a string before calling string methods if (typeof imageValue !== 'string') { console.warn('PostContent: imageValue is not a string:', imageValue); return imageValue; } // Check if it's Obsidian double bracket syntax if (imageValue.startsWith('[[') && imageValue.endsWith(']]')) { // Extract the content inside the double brackets return imageValue.slice(2, -2); } return imageValue; })(); ---