run black on python code in markdown, generalised to any files

  1. vic visual select lines of python codes in markdown code block
  2. :'<,'>!black -q - to replace the visually selected lines with the formatted standard output of the external black command (see :help filter)

:help filter

4.1 Filter commands                 *filter*
A filter is a program that accepts text at standard input, changes it in some
way, and sends it to standard output.  You can use the commands below to send
some text through a filter, so that it is replaced by the filter output.

See also

using flake8 on python in markdown