From 0062fc08917e9ee70148105fe5134e9f4dcf9aba Mon Sep 17 00:00:00 2001
From: "Thomas F. K. Jorna" <hello@tefkah.com>
Date: Sat, 4 Dec 2021 13:44:47 +0100
Subject: fix: add org-attach-id-dir support (#153)

---
 util/processOrg.tsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'util/processOrg.tsx')

diff --git a/util/processOrg.tsx b/util/processOrg.tsx
index 189e980..e139c41 100644
--- a/util/processOrg.tsx
+++ b/util/processOrg.tsx
@@ -44,7 +44,8 @@ export interface ProcessedOrgProps {
   outline: boolean
   collapse: boolean
   linksByNodeId: LinksByNodeId
-  macros?: { [key: string]: string }
+  macros: { [key: string]: string } | {}
+  attachDir: string
 }
 
 export const ProcessedOrg = (props: ProcessedOrgProps) => {
@@ -60,6 +61,7 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
     collapse,
     linksByNodeId,
     macros,
+    attachDir,
   } = props
   if (!previewNode || !linksByNodeId) {
     return null
@@ -68,7 +70,9 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
   const orgProcessor = unified()
     .use(uniorgParse)
     .use(extractKeywords)
-    .use(attachments)
+    .use(attachments, {
+      idDir: attachDir || undefined,
+    })
     .use(uniorgSlug)
     .use(uniorg2rehype, { useSections: true })
 
@@ -146,6 +150,8 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
                   outline={outline}
                   previewNode={previewNode}
                   isWiki={isMarkdown}
+                  macros={macros}
+                  attachDir={attachDir}
                 >
                   {children}
                 </PreviewLink>
-- 
cgit v1.2.3

