# Possibly incorrect \`displayable("text/html")\` in v0.6

**URL:** <https://discourse.julialang.org/t/possibly-incorrect-displayable-text-html-in-v0-6/2145>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 17, 2017, 4:34am UTC](https://discourse.julialang.org/t/possibly-incorrect-displayable-text-html-in-v0-6/2145 "2017-02-17T04:34:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 17, 2017, 4:34am UTC](https://discourse.julialang.org/t/possibly-incorrect-displayable-text-html-in-v0-6/2145/1 "2017-02-17T04:34:37Z")

</div>

This came up in the attempt to get Interact.jl working on v0.6-dev. It currently fails when trying to display some HTML. A MRE is:

```julia
if displayable("text/html")
    display("text/html", """foo""")
end

```

In the REPL in Julia v0.5, `displayable("text/html")` return `false`, which makes sense. In Julia v0.6-dev, however, it returns `true` in the REPL, which leads to errors when trying to actually display:

```julia
               _
   _ _ _(_)_ | A fresh approach to technical computing
  (_) | (_) (_) | Documentation: http://docs.julialang.org
   _ _ _| |_ __ _ | Type "?help" for help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 0.6.0-dev.2834 (2017-02-16 21:11 UTC)
 _/ |\ __'_|_|_|\__'_| | Commit 3222749* (0 days old master)
|__/ | x86_64-apple-darwin15.6.0

julia> displayable("text/html")
true

julia> if displayable("text/html")
           display("text/html", """foo""")
       end
ERROR: MethodError: no method matching show(::Base.TTY, ::MIME{Symbol("text/html")}, ::String)
Closest candidates are:
  show(::IO, ::MIME{mime}) where mime at multimedia.jl:21
  show(::IO, ::ANY) at show.jl:125
  show(::IO, ::AbstractString, ::Any) at multimedia.jl:39
  ...
Stacktrace:
 [1] display(::TextDisplay, ::MIME{Symbol("text/html")}, ::String) at ./multimedia.jl:158
 [2] display(::MIME{Symbol("text/html")}, ::String) at ./multimedia.jl:208
 [3] display(::String, ::String) at ./multimedia.jl:126

```

Specifically, it’s the first display (the Base.TTY) that thinks it can display “text/html”:

```julia
   _ _ _(_)_ | A fresh approach to technical computing
  (_) | (_) (_) | Documentation: http://docs.julialang.org
   _ _ _| |_ __ _ | Type "?help" for help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 0.6.0-dev.2834 (2017-02-16 21:11 UTC)
 _/ |\ __'_|_|_|\__'_| | Commit 3222749* (0 days old master)
|__/ | x86_64-apple-darwin15.6.0

julia> displayable("text/html")
true

julia> displayable(Base.Multimedia.displays[1], "text/html")
true

julia> displayable(Base.Multimedia.displays[2], "text/html")
false

julia> Base.Multimedia.displays[1]
TextDisplay(Base.TTY(RawFD(14) open, 0 bytes waiting))

```

Is this a bug? Or is the package doing something wrong?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 17, 2017, 6:04am UTC](https://discourse.julialang.org/t/possibly-incorrect-displayable-text-html-in-v0-6/2145/2 "2017-02-17T06:04:32Z")

</div>

BTW, `git bisect` shows that this change came in with [8950cf80](https://github.com/JuliaLang/julia/commit/8950cf80586f691a3650204366450106afe350ee)

---

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [February 17, 2017, 8:32am UTC](https://discourse.julialang.org/t/possibly-incorrect-displayable-text-html-in-v0-6/2145/3 "2017-02-17T08:32:10Z")

</div>

Indeed the TextDisplay _is_ able to display HTML; i.e.

```julia
julia> display("text/html", html"<p>Hello</p>")
<p>Hello</p>

```

so this is not really a bug. (Although this display is not so useful.) The reason the MethodError occurs is because `String` cannot be displayed as HTML.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 17, 2017, 4:21pm UTC](https://discourse.julialang.org/t/possibly-incorrect-displayable-text-html-in-v0-6/2145/4 "2017-02-17T16:21:17Z")

</div>

I see, thanks. I’ll fix that in Interact.
