diff --git a/src/components/Collection/CleanDescription.tsx b/src/components/Collection/CleanDescription.tsx index 8ea4dffae..012d4deef 100644 --- a/src/components/Collection/CleanDescription.tsx +++ b/src/components/Collection/CleanDescription.tsx @@ -3,9 +3,13 @@ import React, { useMemo } from 'react'; // The question marks are there because people can't spell… const RemoveSummaryRegex = /\b(Sour?ce|Note|Summ?ary):([^\r\n]+|$)/mg; +const RemoveBasedOnWrittenByRegex = /^(\*|\u2014) ([^\r\n]+|$)/mg; + +const RemoveBBCodeRegex = /\[i\].*\[\/i\]/sg; + const MultiSpacesRegex = /\s{2,}/g; -const CleanMiscLinesRegex = /^(\*|--|~) /sg; +const CleanMiscLinesRegex = /^(--|~) /sg; const CleanMultiEmptyLinesRegex = /\n{2,}/sg; @@ -18,6 +22,8 @@ const CleanDescription = React.memo(({ className, text }: { text: string, classN const cleanedText = text .replaceAll(CleanMiscLinesRegex, '') .replaceAll(RemoveSummaryRegex, '') + .replaceAll(RemoveBasedOnWrittenByRegex, '') + .replaceAll(RemoveBBCodeRegex, '') .replaceAll(CleanMultiEmptyLinesRegex, '\n') .replaceAll(MultiSpacesRegex, ' ');