It's an external filter, you can run it from emacs.
shell-command-on-region, IIRC.
shell-command-on-region, IIRC.
If you want to replace a section of text, not just see the output in another buffer, use C-u M-|
Welcome to the Emacs shell
/tmp $ set-variable `x 6; echo $x
6
/tmp $
M-: (term "pwsh") PowerShell 7.4.0
PS /tmp> set-variable `x 6; echo $x
6
PS /tmp>
Disturbing.