Skip to content

nlink-jp/md-to-slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md-to-slack

Convert Markdown to Slack Block Kit JSON.

Reads Markdown from stdin and writes a {"blocks": [...]} JSON payload to stdout, designed to pair with scli for posting to Slack from the terminal.

Features

  • GFM (GitHub Flavored Markdown) support
  • H1/H2 → Slack header blocks (large font)
  • H3–H6 → bold section blocks
  • Paragraphs, blockquotes, ordered and unordered lists (nested)
  • Fenced and indented code blocks
  • GFM tables → aligned plain-text code blocks
  • Standalone images → Slack image blocks
  • Inline images → link fallback
  • Strikethrough, bold, italic, inline code, links, autolinks
  • Thematic breaks → Slack divider blocks
  • Raw HTML discarded (not renderable in Slack)

Installation

go install github.com/nlink-jp/md-to-slack/cmd/md-to-slack@latest

Or download a pre-built binary from the Releases page.

Usage

md-to-slack < README.md
echo "# Hello **world**" | md-to-slack

Post to Slack with scli

md-to-slack < message.md | scli post --channel general --blocks -

Flags

Flag Description
--version, -V Print version and exit
--help, -h Print usage and exit

Building

make build       # build for current platform
make build-all   # cross-compile for all platforms
make test        # run tests
make check       # vet + lint + test + build

Output format

md-to-slack writes a Slack Block Kit payload:

{
  "blocks": [
    { "type": "header", "text": { "type": "plain_text", "text": "Title", "emoji": true } },
    { "type": "section", "text": { "type": "mrkdwn", "text": "Body text." } }
  ]
}

Documentation

About

Markdown to Slack Block Kit JSON converter — pipe-friendly CLI filter

Topics

Resources

Stars

Watchers

Forks

Contributors