mirror of
https://github.com/preactjs/wmr.git
synced 2026-01-25 15:08:00 +00:00
16 lines
391 B
JavaScript
16 lines
391 B
JavaScript
import MarkupRenderer from 'preact-markup';
|
|
|
|
const COMPONENTS = {
|
|
a(props) {
|
|
if (/^(https?:)?\/\//.test(props.href)) {
|
|
props.target = props.target || '_blank';
|
|
props.rel = 'noopener noreferrer';
|
|
}
|
|
return <a {...props} />;
|
|
}
|
|
};
|
|
|
|
export default function Markup({ html }) {
|
|
return <MarkupRenderer markup={html} components={COMPONENTS} type="html" wrap={false} trim={false} />;
|
|
}
|