|
@@ -618,9 +618,10 @@ function buildAST(md, mdTags=syntax, offset=0, tree={tag: 'root'}, stack=[]){
|
|
|
return currentNode
|
|
|
}
|
|
|
|
|
|
-const Heading = ({react:React, children, title, node: {tag}}) => {
|
|
|
+const Heading = ({react:React, children, title, node: {tag, startMatch}}) => {
|
|
|
const level = +tag.slice(-1)
|
|
|
const _ = React.createElement.bind(React)
|
|
|
+ console.log(startMatch)
|
|
|
if (isNaN(level)) throw new SyntaxError('wrong heading name')
|
|
|
return _(React.Fragment, null,
|
|
|
_(`h${level}`, null, ...title),
|
|
@@ -638,7 +639,7 @@ const Img = ({react:React, children, title, node}) =>{
|
|
|
return _("img", {alt: title, src: children, className: node.startMatch[1] || undefined})
|
|
|
}
|
|
|
|
|
|
-const defaultMapMDToComponents = {
|
|
|
+export const defaultMapMDToComponents = {
|
|
|
heading1: Heading,
|
|
|
heading2: Heading,
|
|
|
heading3: Heading,
|