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

Function applyInlineTextFormatting

packages/shared/src/lib/markdownConversion.ts:9–19  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

7const normalizeText = (value: string): string => value.replace(/\u00a0/g, ' ');
8
9const applyInlineTextFormatting = (value: string): string => {
10 let result = value;
11
12 result = result.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
13 result = result.replace(/~~(.+?)~~/g, '<s>$1</s>');
14 result = result.replace(/\*(?!\*)([^*]+)\*(?!\*)/g, '<em>$1</em>');
15 result = result.replace(/_(.+?)_/g, '<em>$1</em>');
16 result = result.replace(/`([^`]+)`/g, '<code>$1</code>');
17
18 return result;
19};
20
21const inlineMarkdownToHtml = (value: string): string => {
22 let result = escapeHtml(value);

Callers 1

inlineMarkdownToHtmlFunction · 0.70

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected