44Juno's inline display system operates on three distinct levels:
55
661 . If you create a new type and don't define a ` show ` method for it, Juno will use a fallback that lazily shows all fields.
7- 2 . If you've defined a ` show ` method for the ` application/juno+ inline ` MIME type then Juno will
7+ 2 . If you've defined a ` show ` method for the ` application/prs. juno. inline ` MIME type then Juno will
88 - display what is printed by that method or
99 - display the above fallback for the object returned by the ` show ` method.
10103 . If you've defined a ` show ` method for the ` text/plain ` MIME type Juno will use that to create a simple Tree View.
@@ -33,12 +33,12 @@ This default rendering method will not be used if you define e.g.
3333``` julia
3434Base. show (io:: IO , :: MIME"text/plain" , :: Foo ) = print (io, " Foo" )
3535```
36- for displaying this nicely in the REPL. If you also define a ` Base.show(io::IO, ::MIME"application/juno+ inline", ::Foo) `
36+ for displaying this nicely in the REPL. If you also define a ` Base.show(io::IO, ::MIME"application/prs. juno. inline", ::Foo) `
3737method, that will be used instead. As a special case, you can also * return* an object
3838from that show method, and Juno will show that with its default display methods (which allows
3939you to recover what is shown above):
4040``` julia
41- Base. show (io:: IO , :: MIME"application/juno+ inline" , x:: Foo ) = x
41+ Base. show (io:: IO , :: MIME"application/prs. juno. inline" , x:: Foo ) = x
4242```
4343
4444---
@@ -67,7 +67,7 @@ treelabel(io::IO, x::Foo, ::MIME"text/plain") = print(io, "I'm a Foo.")
6767Juno accepts a few different MIME types:
6868 - ` text/plain ` : Probably best compatibility.
6969 - ` text/html ` : Allows much richer display options (e.g. LaTeX).
70- - ` application/juno+ inline ` : Same as ` text/html ` , but specific to Juno.
70+ - ` application/prs. juno. inline ` : Same as ` text/html ` , but specific to Juno.
7171
7272Even ` text/plain ` allows for some (limited) control over styling (colors, decorations).
7373In general, you can print the correct [ SGR codes] ( https://en.wikipedia.org/wiki/ANSI_escape_code#SGR ) and
@@ -100,16 +100,16 @@ treelabel(io::IO, x::Foo, i::Int, ::MIME"text/html") =
100100```
101101![ custom rendering 5] ( ../assets/inline_4.png )
102102
103- The ` application/juno+ inline ` MIME type allows you to make use of the styling Atom uses:
103+ The ` application/prs. juno. inline ` MIME type allows you to make use of the styling Atom uses:
104104``` julia
105- treelabel (io:: IO , x:: Foo , :: MIME"application/juno+ inline" ) =
105+ treelabel (io:: IO , x:: Foo , :: MIME"application/prs. juno. inline" ) =
106106 print (io, " <span class=\" syntax--support syntax--type syntax--julia\" >Junoooooooo!</span>" )
107107```
108108![ custom rendering 6] ( ../assets/inline_5.png )
109109
110110It's also possible to e.g. print no label for ` Foo ` s first field and handle everything in with ` treenode ` :
111111``` julia
112- treelabel (io:: IO , x:: Foo , i:: Int , :: MIME"application/juno+ inline" ) = print (io, " " )
112+ treelabel (io:: IO , x:: Foo , i:: Int , :: MIME"application/prs. juno. inline" ) = print (io, " " )
113113using Markdown
114114treenode (x:: Foo , i:: Int ) = MD ("""
115115 ## Markdown
@@ -123,7 +123,7 @@ treenode(x::Foo, i::Int) = MD("""
123123To hide the ` treenode ` display, simply return ` missing ` :
124124``` julia
125125treenode (x:: Foo , i:: Int ) = missing
126- treelabel (io:: IO , x:: Foo , i:: Int , :: MIME"application/juno+ inline" ) = print (io, " ..." )
126+ treelabel (io:: IO , x:: Foo , i:: Int , :: MIME"application/prs. juno. inline" ) = print (io, " ..." )
127127```
128128![ custom rendering 8] ( ../assets/inline_7.png )
129129
@@ -134,7 +134,7 @@ Nothing at all will be shown if `treelabel` doesn't print anything *and* `treeno
134134## Displaying Plots and Graphics
135135Plots can be displayed by providing a ` show ` method for one of the following MIME types (ordered
136136by priority):
137- 1 . ` application/juno+ plotpane ` - rendered in a [ ` webview ` ] ( https://electronjs.org/docs/api/webview-tag )
137+ 1 . ` application/prs. juno. plotpane+html ` - rendered in a [ ` webview ` ] ( https://electronjs.org/docs/api/webview-tag )
138138 2 . ` image/svg+xml ` - rendered in a [ ` webview ` ] ( https://electronjs.org/docs/api/webview-tag )
139139 3 . ` image/png `
140140 4 . ` image/jpeg `
@@ -157,14 +157,14 @@ Baz(open(f -> read(f, String), "emu.svg"))
157157```
158158![ plot pane svg] ( ../assets/plotpane_svg.png )
159159
160- ` application/juno+ plotpane ` is HTML, but also indicates that you want your type to be displayed in Juno's Plot
160+ ` application/prs. juno. plotpane+html ` is HTML, but also indicates that you want your type to be displayed in Juno's Plot
161161Pane.
162162``` julia
163163struct Blah
164164 data
165165end
166166
167- function Base. show (io:: IO , :: MIME"application/juno+ plotpane" , b:: Blah )
167+ function Base. show (io:: IO , :: MIME"application/prs. juno. plotpane+html " , b:: Blah )
168168 colors = get (io, :juno_colors , nothing )
169169 size = get (io, :juno_plotsize , [100 , 100 ])
170170
0 commit comments