@@ -6628,28 +6628,32 @@ Return, but do not print, the time elapsed since the last [`tic`](:func:`tic`).
66286628toq
66296629
66306630"""
6631- writemime (stream, mime, x)
6631+ show (stream, mime, x)
66326632
6633- The `display` functions ultimately call `writemime ` in order to write an object `x` as a
6633+ The `display` functions ultimately call `show ` in order to write an object `x` as a
66346634given `mime` type to a given I/O `stream` (usually a memory buffer), if possible. In order
66356635to provide a rich multimedia representation of a user-defined type `T`, it is only necessary
6636- to define a new `writemime ` method for `T`, via: `writemime (stream, ::MIME"mime", x::T) = ...`,
6636+ to define a new `show ` method for `T`, via: `show (stream, ::MIME"mime", x::T) = ...`,
66376637where `mime` is a MIME-type string and the function body calls `write` (or similar) to write
66386638that representation of `x` to `stream`. (Note that the `MIME""` notation only supports
66396639literal strings; to construct `MIME` types in a more flexible manner use
66406640`MIME{Symbol("")}`.)
66416641
66426642For example, if you define a `MyImage` type and know how to write it to a PNG file, you
6643- could define a function `writemime (stream, ::MIME"image/png", x::MyImage) = ...` to allow
6643+ could define a function `show (stream, ::MIME"image/png", x::MyImage) = ...` to allow
66446644your images to be displayed on any PNG-capable `Display` (such as IJulia). As usual, be sure
6645- to `import Base.writemime` in order to add new methods to the built-in Julia function
6646- `writemime`.
6645+ to `import Base.show` in order to add new methods to the built-in Julia function
6646+ `show`.
6647+
6648+ The default MIME type is `MIME"text/plain"`. There is a fallback definition for `text/plain`
6649+ output that calls `show` with 2 arguments. Therefore, this case should be handled by
6650+ defining a 2-argument `show(stream::IO, x::MyType)` method.
66476651
66486652Technically, the `MIME"mime"` macro defines a singleton type for the given `mime` string,
66496653which allows us to exploit Julia's dispatch mechanisms in determining how to display objects
66506654of any given type.
66516655"""
6652- writemime
6656+ show (stream, mime, x)
66536657
66546658"""
66556659 mean!(r, v)
@@ -7262,7 +7266,7 @@ Write an informative text representation of a value to the current output stream
72627266should overload `show(io, x)` where the first argument is a stream. The representation used
72637267by `show` generally includes Julia-specific formatting and type information.
72647268"""
7265- show
7269+ show (x)
72667270
72677271"""
72687272 @allocated
@@ -7909,8 +7913,8 @@ rethrow
79097913 reprmime(mime, x)
79107914
79117915Returns an `AbstractString` or `Vector{UInt8}` containing the representation of `x` in the
7912- requested `mime` type, as written by `writemime ` (throwing a `MethodError` if no appropriate
7913- `writemime ` is available). An `AbstractString` is returned for MIME types with textual
7916+ requested `mime` type, as written by `show ` (throwing a `MethodError` if no appropriate
7917+ `show ` is available). An `AbstractString` is returned for MIME types with textual
79147918representations (such as `"text/html"` or `"application/postscript"`), whereas binary data
79157919is returned as `Vector{UInt8}`. (The function `istextmime(mime)` returns whether or not Julia
79167920treats a given `mime` type as text.)
@@ -8303,7 +8307,7 @@ showall
83038307
83048308Returns a boolean value indicating whether or not the object `x` can be written as the given
83058309`mime` type. (By default, this is determined automatically by the existence of the
8306- corresponding `writemime ` function for `typeof(x)`.)
8310+ corresponding `show ` function for `typeof(x)`.)
83078311"""
83088312mimewritable
83098313
0 commit comments