diff options
Diffstat (limited to 'util/processOrg.tsx')
-rw-r--r-- | util/processOrg.tsx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/util/processOrg.tsx b/util/processOrg.tsx index a025645..3f32d30 100644 --- a/util/processOrg.tsx +++ b/util/processOrg.tsx @@ -15,6 +15,7 @@ import rehype2react from 'rehype-react' import { PreviewLink } from '../components/Sidebar/Link' import { NodeByCite, NodeById } from '../pages' import React, { useMemo } from 'react' +import { OrgImage } from '../components/Sidebar/OrgImage' export interface ProcessedOrgProps { nodeById: NodeById @@ -26,7 +27,14 @@ export interface ProcessedOrgProps { } export const ProcessedOrg = (props: ProcessedOrgProps) => { - const { nodeById, setSidebarHighlightedNode, setPreviewNode, previewText, nodeByCite } = props + const { + nodeById, + setSidebarHighlightedNode, + setPreviewNode, + previewText, + nodeByCite, + previewNode, + } = props const processor = unified() .use(uniorgParse) @@ -48,10 +56,13 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => { nodeById={nodeById} setPreviewNode={setPreviewNode} > - {typeof children === 'string' ? children : null} + {children} </PreviewLink> ) }, + img: ({ src }) => { + return <OrgImage src={src as string} file={previewNode.file} /> + }, }, }) |