Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function Code({
className,
children,
language,
style,
}) {
const nodes = refractor.highlight(children, language);
const html = rehype()
.stringify({ type: 'root', children: nodes })
.toString();
return (
<pre style="{style}"> );
}
</pre>
function Code(_ref) {
var className = _ref.className,
children = _ref.children,
language = _ref.language,
style = _ref.style;
var nodes = refractor.highlight(children, language);
var html = (0, _rehype2.default)().stringify({ type: 'root', children: nodes }).toString();
return _react2.default.createElement('pre', {
style: style,
className: (0, _classnames2.default)('ui-kit-code', className),
dangerouslySetInnerHTML: { __html: html }
});
}
function highlight(language, source) {
const lang = ALIASES[language] || language;
if (!refractor.registered(lang)) {
return source;
}
return refractor.highlight(source, lang);
}