(** [format_string f] call the function [f] with a fresh formatter and return the content as a string *) let format_string : (Stdlib.Format.formatter -> unit) -> string = fun f -> let buff = Buffer.create 16 in let format = Stdlib.Format.formatter_of_buffer buff in let () = f format in Stdlib.Format.pp_print_flush format (); Buffer.contents buff