rikhuijzer / PlutoStaticHTML.jl

Convert Pluto notebooks to HTML in automated workflows
https://PlutoStaticHTML.huijzer.xyz
MIT License
81 stars 7 forks source link

HTML file doesn't capture standard output #155

Closed MarkNahabedian closed 1 year ago

MarkNahabedian commented 1 year ago

Pluto notebooks now show text sent to standard output, for example, from println. PlutoStaticHTML is apparently not including this in HTML output though.

rikhuijzer commented 1 year ago

Hi Mark and thanks for your interest in this project.

This issue is a duplicate of #104. My current idea with this project is that the static HTML output should be reasonably polished. For example, I'm using PlutoStaticHTML for my blog (e.g., https://huijzer.xyz/posts/shapley/) and it's used for documentation (e.g., https://manoptjl.org/stable/tutorials/AutomaticDifferentiation/). Showing stdout and stderr would be a distraction. You can still explicitly obtain these outputs via IOCapture.jl.

For example:

using IOCapture
begin
    c = IOCapture.capture() do
        println("test")
    end
    c.output
end

test

Or, to get rid of all the IOCapture, one can use # hide comments:

begin # hide
    c = IOCapture.capture() do # hide
println("test")
    end # hide
    c.output # hide
end # hide

test

which will appear as

println("test")

test

MarkNahabedian commented 1 year ago

Rik, thanks for your quick response.

My notebook uses println to inform the user, as any program would.

Perhaps there should be an option to control whether the HTML should include stdout.