{codeReact}
)}
{domToReact(children, opts)}
);
}
}
if (name === 'a') {
const mention = decodeURIComponent(props.href).match(
/^https?:\/\/matrix.to\/#\/((@|#|!).+:[^?/]+)/
);
if (mention) {
// convert mention link to pill
const mentionId = mention[1];
const mentionPrefix = mention[2];
if (mentionPrefix === '#' || mentionPrefix === '!') {
const mentionRoom =
mentionPrefix === '#'
? getRoomWithCanonicalAlias(mx, mentionId)
: mx.getRoom(mentionId);
return (
{domToReact(children, opts)}
);
}
if (mentionPrefix === '@')
return (
{`@${getMemberDisplayName(room, mentionId) ?? getMxIdLocalPart(mentionId)}`}
);
}
}
if (name === 'span' && 'data-mx-spoiler' in props) {
return (
{domToReact(children, opts)}
);
}
if (name === 'img') {
const htmlSrc = mx.mxcUrlToHttp(props.src);
if (htmlSrc && props.src.startsWith('mxc://') === false) {
return (
{props.alt || props.title || htmlSrc}
);
}
if (htmlSrc && 'data-mx-emoticon' in props) {
return (