As you can see in this transcript, the formatter does not strip trailing whitespace in strings:
$ xxd lib/foo.ex
00000000: 6465 666d 6f64 756c 6520 466f 6f20 646f defmodule Foo do
00000010: 0a20 2064 6566 2068 656c 6c6f 2064 6f0a . def hello do.
00000020: 2020 2020 2222 220a 2020 2020 5768 6974 """. Whit
00000030: 6573 7061 6365 2074 6573 7420 2020 2020 espace test
00000040: 200a 2020 2020 2222 220a 2020 656e 640a . """. end.
00000050: 656e 640a end.
$ mix format
$ xxd lib/foo.ex
00000000: 6465 666d 6f64 756c 6520 466f 6f20 646f defmodule Foo do
00000010: 0a20 2064 6566 2068 656c 6c6f 2064 6f0a . def hello do.
00000020: 2020 2020 2222 220a 2020 2020 5768 6974 """. Whit
00000030: 6573 7061 6365 2074 6573 7420 2020 2020 espace test
00000040: 200a 2020 2020 2222 220a 2020 656e 640a . """. end.
00000050: 656e 640a end.
The file is the same before and after the run.