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

Function getPlainTextFromRichContent

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

Source from the content-addressed store, hash-verified

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

Callers 3

strings.spec.tsFile · 0.90
buildStandupSeoFunction · 0.90

Calls 2

markdownToHtmlBasicFunction · 0.90
stripHtmlTagsFunction · 0.85

Tested by

no test coverage detected