MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / formatTelegramMessage

Function formatTelegramMessage

src/runtime/adapters/markdown.ts:110–132  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

108}
109
110export function formatTelegramMessage(text: string): string {
111 const unwrapped = unwrapMarkdownSourceBlocks(text);
112 const placeholders: string[] = [];
113 const withFenced = protect(
114 unwrapped,
115 FENCED_CODE_BLOCK_RE,
116 placeholders,
117 (block: string) => {
118 const content = block
119 .replace(/^```[^\n]*\n/, "")
120 .replace(/\n```$/, "");
121 return `<pre><code>${escapeHtml(content)}</code></pre>`;
122 },
123 );
124 const withInline = protect(
125 withFenced,
126 INLINE_CODE_RE,
127 placeholders,
128 (_match: string, code: string) => `<code>${escapeHtml(code)}</code>`,
129 );
130
131 return restore(formatTelegramInline(withInline), placeholders);
132}

Callers 1

sendWithRetryMethod · 0.85

Calls 5

protectFunction · 0.85
restoreFunction · 0.85
formatTelegramInlineFunction · 0.85
escapeHtmlFunction · 0.70

Tested by

no test coverage detected