|
@@ -671,11 +671,14 @@ function toReact(ast, React, mapMDToComponents=defaultMapMDToComponents){
|
|
|
const _ = React.createElement.bind(React)
|
|
|
const childToReact = child => typeof child === 'string' ? child :
|
|
|
toReact(child, React, mapMDToComponents)
|
|
|
- return _(RenderComponent, {node: ast,
|
|
|
- key: Math.random(),
|
|
|
- children: ast.children.map(childToReact),
|
|
|
+ const props = {key: Math.random()
|
|
|
+ children: ast.children.map(childToReact)}
|
|
|
+ if (typeof RenderComponent !== 'string' && RenderComponent !== React.Fragment)
|
|
|
+ Object.assign(props,{node: ast,
|
|
|
title: ast.title && ast.title.map(childToReact),
|
|
|
- react: React})
|
|
|
+ react: React}
|
|
|
+
|
|
|
+ return _(RenderComponent, props)
|
|
|
}
|
|
|
|
|
|
export {buildAST, toReact}
|