CopilotKitDocs
  • Docs
  • Reference
  • Cookbook
Get Intelligence free
CopilotKitDocs
DocsReferenceCookbook
DocsReferenceCookbook

@copilotkit/bot

@copilotkit/bot-slack

slackrenderBlockKitmarkdownToMrkdwndefaultSlackToolsdefaultSlackContextSanitizingHttpAgent
ReferencebotSlack

markdownToMrkdwn

Translate GFM Markdown to Slack mrkdwn — bold, links, lists, and tables rendered monospace in a code fence.


Overview

markdownToMrkdwn converts GitHub-flavored Markdown — what agents emit — into Slack's mrkdwn dialect. The adapter applies it automatically to every streamed chunk and every Section/Markdown block, so agent output renders correctly without the model knowing about mrkdwn.

Signature

import { markdownToMrkdwn } from "@copilotkit/bot-slack";

function markdownToMrkdwn(input: string): string;

Behavior

  • Inline styles — GFM emphasis is rewritten to mrkdwn (e.g. **bold** → *bold*); links become mrkdwn <url|label> form; lists are normalized.
  • Code passes through — fenced ``` blocks and inline `code` are left untouched; they render identically in both flavors.
  • Tables become monospace — mrkdwn has no table primitive, so GFM tables are column-aligned and wrapped in a code fence to stay readable.
  • Applied per chunk — during streaming, the translation runs on each flushed chunk, paired with the mid-stream auto-closer so partially streamed markdown still renders.

Related

  • slack() — streaming behavior and where this runs
  • defaultSlackContext — steers the agent's formatting expectations
570dd39