Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (ctx.cursorPosition && WikiParser.isInside(ctx.cursorPosition, position)) {
propsForElem.className += ' active-inner'; // must have 'md' class
}
}
delete propsForElem.position;
}
return React.createElement(name, propsForElem, children);
}
let rootNode = customHast;
if (rootNode.type === 'root') {
rootNode = clone(rootNode);
rootNode.type = 'element';
rootNode.tagName = 'div';
}
return toH(h, rootNode);
}
this.Compiler = node => {
parseFrontmatter(node)
console.log(node)
return toHyper(h, {
type: 'element',
tagName: 'div',
properties: {},
children: toHast(node, {
allowDangerousHTML: true,
handlers: {
html: (h, node, parent) => {
console.log(parent)
parent.type = 'element'
parent.tagName = 'React.Fragment'
}
}
}).children
})
}
}
function toElements(data) {
if (!data) {
return null;
}
const root = toh(React.createElement, data);
return root.props.children;
}
type: 'element',
tagName: FRAGMENT_TAG_NAME,
properties: {},
children: node.children,
};
}
function h(name, props, children) {
return React.createElement(
getReactElement(name, components),
props,
getReactChildren(name, children),
);
}
return toH(h, node);
}
function toElements(data) {
if (!data) {
return null;
}
const root = toh(React.createElement, data);
return root.props.children;
}
export const getHighlightedCode = (
code: string,
lang: string,
firstLineNum: number
): React.ReactNode[] | string => {
let ast = getHast(code, lang);
if (ast) {
if (!isNaN(firstLineNum)) {
ast = addLineNumber(ast, firstLineNum || 1).nodes;
}
const root = toH(React.createElement, { type: "root", children: ast });
return root.props.children;
}
return code;
};
function toElements(children) {
if (!Array.isArray(children)) {
return children;
}
const root = toh(React.createElement, {
type: "element",
tagName: "div",
children
});
return root.props.children;
}