({
html,
markdown,
}: RichContentPlainTextOptions)
| 128 | * so link labels are preserved without leaking markdown syntax or raw URLs. |
| 129 | */ |
| 130 | export const getPlainTextFromRichContent = ({ |
| 131 | html, |
| 132 | markdown, |
| 133 | }: RichContentPlainTextOptions): string => { |
| 134 | const htmlText = stripHtmlTags(html ?? ''); |
| 135 | if (htmlText) { |
| 136 | return htmlText; |
| 137 | } |
| 138 | |
| 139 | if (!markdown) { |
| 140 | return ''; |
| 141 | } |
| 142 | |
| 143 | return stripHtmlTags(markdownToHtmlBasic(markdown)); |
| 144 | }; |
| 145 | |
| 146 | /** |
| 147 | * Escapes special markdown characters in user-generated content |
no test coverage detected