Skip to content

Commit e694d58

Browse files
authored
feat(types): add markdown block (#2296)
1 parent 5bcef49 commit e694d58

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

packages/types/src/block-kit/blocks.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ export interface Block {
4444
* {@link https://api.slack.com/reference/block-kit/blocks Blocks reference}.
4545
*/
4646
export type KnownBlock =
47-
| ImageBlock
48-
| ContextBlock
4947
| ActionsBlock
48+
| ContextBlock
5049
| DividerBlock
51-
| SectionBlock
52-
| InputBlock
5350
| FileBlock
5451
| HeaderBlock
55-
| VideoBlock
56-
| RichTextBlock;
52+
| ImageBlock
53+
| InputBlock
54+
| MarkdownBlock
55+
| RichTextBlock
56+
| SectionBlock
57+
| VideoBlock;
5758

5859
/**
5960
* A helper union type of all known Blocks as well as the generic {@link Block} interface. A full list of known blocks
@@ -245,6 +246,23 @@ export interface InputBlock extends Block {
245246
dispatch_action?: boolean;
246247
}
247248

249+
/**
250+
* @description This block can be used with AI apps when you expect a markdown response from an LLM that can get lost in
251+
* translation rendering in Slack. Providing it in a markdown block leaves the translating to Slack to ensure your message
252+
* appears as intended. Note that passing a single block may result in multiple blocks after translation.
253+
* @see {@link https://api.slack.com/reference/block-kit/blocks#markdown Markdown block reference}
254+
*/
255+
export interface MarkdownBlock extends Block {
256+
/**
257+
* @description The type of block. For a markdown block, `type` is always `input`.
258+
*/
259+
type: 'markdown';
260+
/**
261+
* @description The standard markdown-formatted text. Limit 12,000 characters max.
262+
*/
263+
text: string;
264+
}
265+
248266
/**
249267
* A helper union type of all Block Elements that can be used in a {@link RichTextBlock}.
250268
* @see {@link https://api.slack.com/reference/block-kit/blocks#rich_text Rich text block reference}.

0 commit comments

Comments
 (0)