MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / markdownToSlackLinks

Function markdownToSlackLinks

server/src/addie/security.ts:112–121  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

110 * This is a known limitation of simple regex-based parsing.
111 */
112export function markdownToSlackLinks(text: string): string {
113 // Match markdown links: [text](url)
114 // Capture group 1: link text, Capture group 2: URL
115 return text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, linkText, url) => {
116 // Escape pipe characters in link text to prevent breaking Slack mrkdwn
117 // lgtm[js/incomplete-sanitization] -- only pipe needs escaping for Slack mrkdwn <url|text> syntax
118 const escapedText = linkText.replace(/\|/g, '\\|');
119 return `<${url}|${escapedText}>`;
120 });
121}
122
123/**
124 * Validate output before sending to Slack

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected