Skip to content
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

Rendering Jupyter notebook output #9

Open
darsnack opened this issue Jan 26, 2021 · 1 comment
Open

Rendering Jupyter notebook output #9

darsnack opened this issue Jan 26, 2021 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@darsnack
Copy link
Contributor

darsnack commented Jan 26, 2021

In FastAI.jl, our examples/tutorials require training on a GPU. Running this code locally in a Jupyter notebook, then committing the notebook w/ output to the repo seems like the best solution. Currently, Publish.jl doesn't render the output of cells:

image

What would be required to render the output?

cc @lorenzoh

@MichaelHatherly
Copy link
Owner

Running this code locally in a Jupyter notebook, then committing the notebook w/ output to the repo seems like the best solution.

Yeah, that is probably the best approach for that use case.

I think it was probably just an oversight not rendering the output cells. Would probably need some changes to

Publish.jl/src/load.jl

Lines 124 to 146 in ad46c6c

function loadfile(::Extension{:ipynb}, env, path)
dict = open(JSON.parse, path)
io = IOBuffer()
if haskey(dict, "cells")
for cell in dict["cells"]
if haskey(cell, "cell_type")
type = cell["cell_type"]
source = get(cell, "source", "")
if type == "markdown"
join(io, source)
println(io)
elseif type == "code"
println(io, CODE_FENCE, "julia")
join(io, source)
println(io)
println(io, CODE_FENCE)
end
end
end
end
parser = init_markdown_parser(env["publish"])
return load_markdown(io, parser)
end
to capture the cell output and then embed a suitable value within the resulting ast prior to the rendering stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants