format-teams-messagelisted
Install: claude install-skill magnusrodseth/dotfiles
# Format Teams Message
Format a Markdown message for Microsoft Teams and copy it to the macOS clipboard as HTML.
Teams does **not** parse Markdown on paste. Pasting plain Markdown leaves the raw characters (`**`, `>`, `` ` ``, etc.) visible. To get real formatting, HTML must be placed on the macOS clipboard under the `public.html` flavor. Teams reads that flavor on paste and renders it.
## Workflow
1. Take the message content (from the user or generated in the conversation).
2. Ensure it is valid Markdown. Adjust if the input has obvious mistakes that would break the HTML conversion.
3. Convert Markdown → HTML using `pandoc`.
4. Place the HTML on the clipboard using `osascript` with the AppKit framework.
5. Confirm the copy and remind the user to paste into Teams.
## Implementation
```bash
# 1) Write the message to a temp file (use HEREDOC to preserve formatting)
cat > /tmp/teams-msg.md << 'EOF'
<MARKDOWN CONTENT GOES HERE>
EOF
# 2) Convert to HTML. Use --wrap=none to avoid pandoc inserting hard line breaks.
pandoc -f markdown -t html --wrap=none /tmp/teams-msg.md > /tmp/teams-msg.html
# 3) Put HTML on the clipboard via osascript (public.html flavor)
osascript <<'APPLESCRIPT'
use framework "AppKit"
use scripting additions
set theHTML to (do shell script "cat /tmp/teams-msg.html")
set pb to current application's NSPasteboard's generalPasteboard()
pb's clearContents()
pb's setString:theHTML forType:"public.html"
return "Copied to clipboard. HTML length: " & (length of t