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

Function formatTelegramInline

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

Source from the content-addressed store, hash-verified

64}
65
66function formatTelegramInline(text: string): string {
67 let formatted = escapeHtml(text);
68
69 formatted = formatted.replace(LINK_RE, (_, label: string, url: string) => {
70 return `<a href="${escapeHtmlAttribute(url)}">${escapeHtml(label)}</a>`;
71 });
72 formatted = formatted.replace(
73 /^(#{1,6})[ \t]+(.+)$/gm,
74 (_, __: string, content: string) => `<b>${content.trim()}</b>`,
75 );
76 formatted = formatted.replace(/\*\*([^*\n]+)\*\*/g, "<b>$1</b>");
77 formatted = formatted.replace(/__([^_\n]+)__/g, "<b>$1</b>");
78 formatted = formatted.replace(
79 /(^|[^\w<])\*([^*\n]+)\*(?=[^\w>]|$)/g,
80 "$1<i>$2</i>",
81 );
82 formatted = formatted.replace(
83 /(^|[^\w<])_([^_\n]+)_(?=[^\w>]|$)/g,
84 "$1<i>$2</i>",
85 );
86 formatted = formatted.replace(/^(?:-|\*) /gm, "• ");
87
88 return formatted;
89}
90
91export function formatSlackMessage(text: string): string {
92 const unwrapped = unwrapMarkdownSourceBlocks(text);

Callers 1

formatTelegramMessageFunction · 0.85

Calls 2

escapeHtmlAttributeFunction · 0.85
escapeHtmlFunction · 0.70

Tested by

no test coverage detected