MCPcopy Create free account
hub / github.com/dailydotdev/apps / getPlainTextFromRichContent

Function getPlainTextFromRichContent

packages/shared/src/lib/strings.ts:136–150  ·  view source on GitHub ↗
({
  html,
  markdown,
}: RichContentPlainTextOptions)

Source from the content-addressed store, hash-verified

134 * so link labels are preserved without leaking markdown syntax or raw URLs.
135 */
136export const getPlainTextFromRichContent = ({
137 html,
138 markdown,
139}: RichContentPlainTextOptions): string => {
140 const htmlText = stripHtmlTags(html ?? '');
141 if (htmlText) {
142 return htmlText;
143 }
144
145 if (!markdown) {
146 return '';
147 }
148
149 return stripHtmlTags(markdownToHtmlBasic(markdown));
150};
151
152/**
153 * Escapes special markdown characters in user-generated content

Callers 2

useStoredCommentDraftFunction · 0.90
strings.spec.tsFile · 0.90

Calls 2

markdownToHtmlBasicFunction · 0.90
stripHtmlTagsFunction · 0.85

Tested by

no test coverage detected