Skip to content

Commit

Permalink
fix formatting (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub authored Oct 24, 2024
1 parent 98c6302 commit e282419
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function to_img(t::Tiling)
img[i, j] = img[i, j + 1] = col
end
end
img
return img
end

function Base.show(io::IO, (; N, x)::Tiling)
Expand All @@ -25,6 +25,7 @@ function Base.show(io::IO, (; N, x)::Tiling)
Base._show_nonempty(IOContext(io, :compact => true), parent(x), "")
end
print(io, ")")
return nothing
end

function Base.show(io::IO, ::MIME"text/plain", t::Tiling)
Expand Down Expand Up @@ -74,6 +75,7 @@ function Base.show(io::IO, ::MIME"text/plain", t::Tiling)
print(io, " ")
end
end
return nothing
end

Base.showable(::MIME"image/png", (; N)::Tiling) = N > 0
Expand All @@ -82,6 +84,7 @@ function Base.show(io::IO, ::MIME"image/png", t::Tiling; kw...)
io = IOContext(io, :full_fidelity => true)
img = to_img(adapt(Array, t))
show(io, MIME("image/png"), img; kw...)
return nothing
end

Base.showable(::MIME"juliavscode/html", (; N)::Tiling) = N > 0
Expand All @@ -93,4 +96,5 @@ function Base.show(io::IO, ::MIME"juliavscode/html", t::Tiling; kw...)
show(b64_io, MIME("image/png"), img; kw...)
close(b64_io)
print(io, "' style='width: 100%; max-height: 500px; object-fit: contain; image-rendering: pixelated' />")
return nothing
end

0 comments on commit e282419

Please sign in to comment.