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

Function applyInlineTextFormatting

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

Source from the content-addressed store, hash-verified

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

Callers 1

inlineMarkdownToHtmlFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected