Moved markdown image loading to a static asset

This commit is contained in:
Mitchell McCaffrey
2020-07-01 20:19:26 +10:00
parent 7538e65d0c
commit 6fe26c66b4
5 changed files with 19 additions and 6 deletions
+8 -2
View File
@@ -109,7 +109,7 @@ function Link({ href, children }) {
}
}
function Markdown({ source }) {
function Markdown({ source, assets }) {
const renderers = {
paragraph: Paragraph,
heading: Heading,
@@ -123,7 +123,13 @@ function Markdown({ source }) {
tableRow: TableRow,
tableCell: TableCell,
};
return <ReactMarkdown source={source} renderers={renderers} />;
return (
<ReactMarkdown
source={source}
renderers={renderers}
transformImageUri={(uri) => assets[uri]}
/>
);
}
export default Markdown;