fix(markdown): address inline image review feedback

Keep the leading slash when resolving relative paths against an absolute
markdown file, retry an inline image when its source changes after a load
failure, and render linked markdown images without a nested expand button.
This commit is contained in:
Chris Scott committed 2026-10-13 01:46:51 +00:00
1 parent 458f26134b
commit f488b8762d
7 files changed
+118 -22

No files matched your search

@@ -1,6 +1,7 @@
import type { ComponentPropsWithoutRef } from 'react'
import type { ExtraProps } from 'react-markdown'
import { InlineImage } from '@/components/ui/inline-image'
import { useIsInsideMarkdownLink } from '@/components/ui/markdown-link'
import { getFileApiUrl } from '@/api/files'
import { getLocalLinkPath } from '@/lib/markdownLinks'
@@ -14,6 +15,8 @@ type MarkdownImageProps = ComponentPropsWithoutRef<'img'> & ExtraProps & {
* `data:image/*` URIs, is rendered unchanged.
*/
export function MarkdownImage({ src, alt, resolveLocalPath }: MarkdownImageProps) {
const insideLink = useIsInsideMarkdownLink()
if (typeof src !== 'string' || src === '') {
return null
}
@@ -30,5 +33,5 @@ export function MarkdownImage({ src, alt, resolveLocalPath }: MarkdownImageProps
}
}
return <InlineImage src={imageSrc} alt={alt} />
return <InlineImage src={imageSrc} alt={alt} expandable={!insideLink} />
}