2024-04-16 12:56:47 +02:00
|
|
|
import { TDescendant, Value } from '@udecode/slate'
|
2024-01-31 08:03:13 +01:00
|
|
|
|
|
|
|
|
import { remarkTransformNode } from './remarkTransformNode'
|
|
|
|
|
import { MdastNode, RemarkPluginOptions } from './types'
|
|
|
|
|
|
|
|
|
|
export const remarkTransformElementChildren = <V extends Value>(
|
|
|
|
|
node: MdastNode,
|
|
|
|
|
lastLineNumber: number,
|
|
|
|
|
options: RemarkPluginOptions<V>
|
|
|
|
|
): TDescendant[] => {
|
|
|
|
|
const { children } = node
|
|
|
|
|
if (!children) return []
|
|
|
|
|
|
|
|
|
|
return children.flatMap((child) =>
|
|
|
|
|
remarkTransformNode(child, lastLineNumber, options)
|
|
|
|
|
)
|
|
|
|
|
}
|