Closed goerz closed 9 months ago
Duplicate of #181
Agreed, it's a duplicate, and I figured out how to use DisplayAs
as a workaround:
# # Minimum Working Example
#
# Print a long array:
import DisplayAs # md
a = rand(1000)
#md a |> DisplayAs.withcontext(:limit => true) #hide
# Print a long matrix:
A = rand(2, 1000)
#md A |> DisplayAs.withcontext(:limit => true) #hide
I might still look into whether this has a better solution, since I agree with https://github.com/fredrikekre/Literate.jl/issues/181#issuecomment-1101959946 that the default output should emulate the REPL.
But the need is less pressing than I thought initially.
Closing in favor of #181
Consider the following
mwe_document.jl
:Executing this with
produces a
.md
file that shows all values of the array and matrix. This is both non-ideal to look at and produces a large file.In contrast, running the code in a terminal will show the array/matrix truncated, e.g.,
The number of printed elements depends on the size of the terminal (see
displaysize
in IOContext).A Jupyter notebook also truncates the output, apparently using the standard 80x24 terminal size.
Literate
should set theIOContext
during execution to mimic a standard terminal. The 80x24 size is probably a good default.I'll have a look to see if I can fix this.