forked from fonsp/Pluto.jl
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@printf? #22
Comments
using PlutoUI
with_terminal() do
println("BLA")
end outputs nothing at all in a fresh Neptune notebook. |
Put this together recently, which does the job using IOCapture
import HypertextLiteral: @htl
function display_output(value, output)
# parts of this scavenged from PlutoUI
t = """<div style='display: inline; white-space: normal;'><pre style="
max-height: 300px;
overflow: auto;
white-space: pre;
color: white;
background-color: black;
border-radius: 3px;
margin-top: 4px;
margin-bottom: 4px;
padding: 5px;
display: block;
font-family: monospace;
font-size: 9pt;
">"""
t *= value == nothing ? "" : "<span>$(value)<br></span>"
for line in split(output, "\n")[1:(end-1)]
t *= "<span>$(line)<br></span>"
end
t *= "</pre></div>"
ex = :(@htl($t))
ex
end
macro show_output(cmd)
return quote
c = IOCapture.capture(color = true) do
eval($cmd)
end
ex = display_output(c.value, c.output)
eval(ex)
end
end The above allows you to print in your functions, including logging, and showing the output in the Neptune notebook with the macro Colors don't appear to be working though. |
@dpo Thanks for this I'm curious why loops like
don't work? It says |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a convenient way to print in Neptune (contrary to Pluto)?
The text was updated successfully, but these errors were encountered: