Right, given the behaviour can be achieved, I would rather rely on post-processing compared to adding more complexity to the codebase, unless there is a reason not to.
Note you could also perform a String.replace(string, "\n", "\n "). On Thu, Dec 1, 2022 at 6:17 PM Daniel Kukuła <daniel.k...@gmail.com> wrote: > Recently I did a pr to hammox to use pretty printing in the inspected map. > Currently this is inspected as one line single line and it's a pain to > look at when you have an mismatch in a struct. > The way hammox displays the errors is every nested error is padded 2 > spaces deeper. > I had to split the inspected message and then join it with padding - I > think that inspect should support it out of the box so we don't have to > post process the generated message. > html is just an example where it's useful- every time I did inspect in a > template I remember the same problem - the inspected structure is one long > line. > > https://github.com/msz/hammox/blob/a7afe45fd0f8ba79d06fde0a75458f76853572b3/lib/hammox/type_match_error.ex#L150 > > On Thursday, December 1, 2022 at 5:03:54 PM UTC José Valim wrote: > >> Hi Daniel, >> >> Can you please provide more information about the problem you are trying >> to solve? I have rendered inspected representations on HTML several times >> and I never needed extensions to the API. You should always be able to >> replace "\n" by either padding or "<br />" without concerns on the rendered >> output. So if you can explain what is not working or not possible, it would >> help move this forward. >> >> Thanks! >> >> On Thu, Dec 1, 2022 at 5:57 PM Daniel Kukuła <danie...@gmail.com> wrote: >> >>> Currently we can set the width when inspecting - it would be useful to >>> have also a padding option that accepts either an integer of empty strings >>> or better a custom string so we can add `<br>` when pretty printing in html >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-co...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/d55f03e0-20d0-4ca6-acdb-34ec97d510fan%40googlegroups.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/d55f03e0-20d0-4ca6-acdb-34ec97d510fan%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/e5936dd2-5e41-419b-ad5a-ec68282f72ben%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/e5936dd2-5e41-419b-ad5a-ec68282f72ben%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JtLHbwGMgGEfSPDBwyzwgy-fwtrspgX64Wm4XQeRKgwg%40mail.gmail.com.