Skip to content

Commit

Permalink
Fix printing guidelines
Browse files Browse the repository at this point in the history
Properly explain how to reach each printing mode, and also explain what 'io' is
  • Loading branch information
fingolfin committed Sep 5, 2023
1 parent 4768797 commit 839b063
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/src/DeveloperDocumentation/printing_details.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ found in the [Developer Style Guide](@ref).

## Implementing show functions

Here is the translation between `:detail`, `one line` and `:supercompact`.
Here is the translation between `:detail`, `one line` and `:supercompact`,
where `io` is an `IO` object (such as `stdout` or an `IOContext`):

```
print(io, "text/plain", x) # detailed printing
print(io, x) # one line printing
print(IOContext(:supercompact => true), x) # supercompact printing
show(io, MIME"text/plain"(), x) # detailed printing
print(io, x) # one line printing
print(IOContext(io, :supercompact => true), x) # supercompact printing
```

For reference, string interpolation `"$(x)"` will also use `print(io, x)`.
For reference, string interpolation `"$(x)"` uses one line printing via `print(io, x)`,
while on the REPL detailed printing is used to show top level objects.

### Mockup

Expand Down

0 comments on commit 839b063

Please sign in to comment.