I'm sure I can whip something up quick for this but it's got to have been done somewhere already despite my searching to no avail.
julia> C = randn((3,3));
julia> display(C)
3×3 Matrix{Float64}:
-0.727312 -0.587578 0.153316
-1.42021 0.891044 -0.295916
-0.272352 1.15303 -0.788879
julia> display_indented(C; level=4) # want to have this
3×3 Matrix{Float64}:
-0.727312 -0.587578 0.153316
-1.42021 0.891044 -0.295916
-0.272352 1.15303 -0.788879
Or even better a function that returns what would have been displayed as a string with the specified indentation.
I don't think there's really anything built in, but something like this probably does what you want:
replace(sprint(show, MIME("text/plain"), C), r"^"m => " "^4)
Last updated: Nov 22 2024 at 04:41 UTC