Filter #<weight>...</weight> from metadata (#3741)

This commit is contained in:
Jaco Greeff 2020-09-22 14:54:10 +02:00 committed by GitHub
parent d001d8e83d
commit 44d8aa962e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,11 +46,12 @@ function formatMeta (meta?: Meta): React.ReactNode | null {
const strings = meta.documentation.map((doc) => doc.toString().trim());
const firstEmpty = strings.findIndex((doc) => !doc.length);
const parts = splitParts((
const combined = (
firstEmpty === -1
? strings
: strings.slice(0, firstEmpty)
).join(' ').replace(/\\/g, '').replace(/`/g, ''));
).join(' ').replace(/#(<weight>| <weight>).*<\/weight>/, '');
const parts = splitParts(combined.replace(/\\/g, '').replace(/`/g, ''));
return <>{parts.map((part, index) => index % 2 ? <em key={index}>[{part}]</em> : <span key={index}>{part}</span>)}&nbsp;</>;
}