Proper way to hook into REPL display of type



I want to overwrite how a particular type is displayed if my package is loaded, but only in the interactive REPL.

I found that I can overload display(d::Base.REPL.REPLDisplay, ...), but now I am a bit stuck without digging in Base code.

Right now I do the naive thing and just print("something") in that function which has the desired effect, but I wonder if that may have some edgecases I did not consider. It also looks different than other output (the text in the first line isn’t bold)

I did try print(d, "something") but that did not have the effect I expected.

Any pointers?

REPL output for subtype of Function

Don’t override display. See