Skip to content

Add Markdown to Mrkdwn conversion for Slack messages#2

Merged
alexec merged 7 commits intomainfrom
copilot/convert-markdown-to-mrkdown
Oct 19, 2025
Merged

Add Markdown to Mrkdwn conversion for Slack messages#2
alexec merged 7 commits intomainfrom
copilot/convert-markdown-to-mrkdown

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 19, 2025

Problem

The Slack CLI tool accepts messages but the Slack API uses Mrkdwn format, which differs from standard Markdown. Users need to manually convert their Markdown-formatted messages, which is inconvenient for coding agents and automation tools.

Solution

This PR implements automatic Markdown to Mrkdwn conversion, allowing users to write messages in standard Markdown format while ensuring compatibility with Slack's formatting requirements.

Key Changes

Automatic Format Conversion (markdown.go)

  • Converts standard Markdown syntax to Slack's Mrkdwn format transparently
  • Uses regex patterns with placeholder protection to handle nested formatting correctly
  • Supports all common Markdown elements:
    • Bold: **text** or __text__*text*
    • Italic: *text*_text*
    • Strikethrough: ~~text~~~text~
    • Links: [text](url)<url|text>
    • Code blocks with language specifiers (including c++, c#, objective-c)
    • Unordered lists: * item or - item• item

Example Conversion

Input:  **Status**: Build ~~failed~~ *succeeded*! Check [logs](https://example.com/logs)
Output: *Status*: Build ~failed~ _succeeded_! Check <https://example.com/logs|logs>

Testing (markdown_test.go)

  • 15 comprehensive test cases covering all conversion scenarios
  • Edge cases including complex language specifiers and mixed formatting
  • All tests passing

Documentation Updates (README.md)

  • Updated agent prompt to mention automatic Markdown conversion

Benefits

  • No breaking changes: Existing usage continues to work
  • Zero dependencies: Uses only Go standard library
  • Transparent: Conversion happens automatically
  • Well-tested: Comprehensive test coverage
  • Secure: CodeQL scan found no vulnerabilities
  • Agent-friendly: Makes it easier for coding agents to send formatted Slack messages

Users can now send messages using familiar Markdown syntax without worrying about Slack's formatting differences.

Original prompt

The API allows you to add a message. This message should be in Markdown format. However, the Slack API uses a weird format called Mrkdown. Find a library to convert the Markdown to Mrkdown. Then, think about other things you add to a Slack message. Suggest some ideas.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
@alexec
Copy link
Copy Markdown
Contributor

alexec commented Oct 19, 2025

@copilot please remember to delete the slack-cli when you're done.

Copilot AI and others added 3 commits October 19, 2025 00:37
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
…cifier patterns

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Add library for Markdown to Mrkdown conversion Add Markdown to Mrkdwn conversion for Slack messages Oct 19, 2025
Copilot AI requested a review from alexec October 19, 2025 00:46
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 19, 2025

@copilot please remember to delete the slack-cli when you're done.

Done! The slack-cli binary was removed in commit 4f0478d and added to .gitignore to prevent it from being committed again.

@alexec
Copy link
Copy Markdown
Contributor

alexec commented Oct 19, 2025

@copilot Good work! Please remove the ideas document.

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 19, 2025

@copilot Good work! Please remove the ideas document.

Done! Removed FEATURES.md and the suggested features section from README in commit that will be pushed.

Copilot AI requested a review from alexec October 19, 2025 01:21
@alexec alexec marked this pull request as ready for review October 19, 2025 16:19
@alexec alexec merged commit 8489492 into main Oct 19, 2025
@alexec alexec deleted the copilot/convert-markdown-to-mrkdown branch October 19, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants