Skip to content

Instantly share code, notes, and snippets.

@skydiver
Created March 7, 2026 20:08
Show Gist options
  • Select an option

  • Save skydiver/66e7b03438a4a9856b5e7b8cffb9b718 to your computer and use it in GitHub Desktop.

Select an option

Save skydiver/66e7b03438a4a9856b5e7b8cffb9b718 to your computer and use it in GitHub Desktop.
Claude Code: format .md files on save
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "bash -c 'FILE=$(cat | jq -r \".tool_input.file_path // empty\"); if [[ \"$FILE\" == *.md ]] && command -v prettier &>/dev/null; then prettier --write --prose-wrap preserve \"$FILE\" 2>/dev/null || true; fi'"
}
]
}
]
@skydiver
Copy link
Author

skydiver commented Mar 7, 2026

npm install -g prettier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment