diff --git a/super-man.sh b/super-man.sh index f604352..1e0d56e 100755 --- a/super-man.sh +++ b/super-man.sh @@ -335,10 +335,14 @@ ai_build_prompt() { esac } -# Strip markdown fences and surrounding blank lines from a raw model response. +# Strip markdown fences, surrounding blank lines, and a single pair of inline +# backticks wrapping the whole line (coder models often emit `cmd`). Only a +# matching leading+trailing pair is removed, so command substitution like +# `date` inside a longer command is left untouched. ai_clean_response() { awk '/^[[:space:]]*```/ { next } { print }' \ | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' \ + | sed -E 's/^`(.*)`$/\1/' \ | sed '/^$/d' }