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

Function getPlainTextFromRichContent

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

Source from the content-addressed store, hash-verified

128 * so link labels are preserved without leaking markdown syntax or raw URLs.
129 */
130export 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

Callers 3

strings.spec.tsFile · 0.90
buildStandupSeoFunction · 0.90

Calls 2

markdownToHtmlBasicFunction · 0.90
stripHtmlTagsFunction · 0.85

Tested by

no test coverage detected