@@ -33,6 +33,10 @@ import { Section } from '../components/Sidebar/Section'
33
33
import { NoteContext } from './NoteContext'
34
34
import { OrgRoamLink , OrgRoamNode } from '../api'
35
35
36
+ // @ts -expect-error non-ESM unified means no types
37
+ import { toString } from 'hast-util-to-string'
38
+ import { Box } from '@chakra-ui/react'
39
+
36
40
export interface ProcessedOrgProps {
37
41
nodeById : NodeById
38
42
previewNode : OrgRoamNode
@@ -63,6 +67,7 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
63
67
macros,
64
68
attachDir,
65
69
} = props
70
+
66
71
if ( ! previewNode || ! linksByNodeId ) {
67
72
return null
68
73
}
@@ -96,7 +101,6 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
96
101
}
97
102
98
103
const wikiLinkProcessor = ( wikiLink : string ) : string => {
99
- console . log ( wikiLink )
100
104
return `id:${ wikiLink } `
101
105
}
102
106
@@ -160,11 +164,18 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
160
164
img : ( { src } ) => {
161
165
return < OrgImage src = { src as string } file = { previewNode ?. file } />
162
166
} ,
163
- section : ( { children, className } ) => (
164
- < Section { ...{ outline, collapse } } className = { className as string } >
165
- { children }
166
- </ Section >
167
- ) ,
167
+ section : ( { children, className } ) => {
168
+ console . log ( className )
169
+ console . log ( previewNode . level )
170
+ if ( className && ( className as string ) . slice ( - 1 ) === `${ previewNode . level } ` ) {
171
+ return < Box > { ( children as React . ReactElement [ ] ) . slice ( 1 ) } </ Box >
172
+ }
173
+ return (
174
+ < Section { ...{ outline, collapse } } className = { className as string } >
175
+ { children }
176
+ </ Section >
177
+ )
178
+ } ,
168
179
p : ( { children } ) => {
169
180
return < p lang = "en" > { children as ReactNode } </ p >
170
181
} ,
@@ -178,6 +189,3 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
178
189
< NoteContext . Provider value = { { collapse, outline } } > { text as ReactNode } </ NoteContext . Provider >
179
190
)
180
191
}
181
- function useCallBack ( arg0 : ( ) => unified . Processor < unified . Settings > ) {
182
- throw new Error ( 'Function not implemented.' )
183
- }
0 commit comments