Skip to content

More stable notebook file parsing when cell order is missing#3285

Merged
fonsp merged 9 commits into
mainfrom
more-stable-notebook-cell-order-parsing
Aug 1, 2025
Merged

More stable notebook file parsing when cell order is missing#3285
fonsp merged 9 commits into
mainfrom
more-stable-notebook-cell-order-parsing

Conversation

@fonsp

@fonsp fonsp commented Jul 1, 2025

Copy link
Copy Markdown
Member

Split out from #3279, to make Pluto more future-proof for when we release #3179.

This PR makes Pluto better at opening notebook files that are missing the Cell Order section at the bottom of the file.

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="more-stable-notebook-cell-order-parsing")
julia> using Pluto

@KeithWM KeithWM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did my best to do some review because I do really appreciate the effort, but I'm not sure how valuable my comments are.

Comment thread sample/Basic.jl
Comment thread src/notebook/saving and loading.jl
Comment thread src/notebook/saving and loading.jl Outdated
Comment thread src/notebook/saving and loading.jl
Comment thread src/notebook/saving and loading.jl
@fonsp

fonsp commented Jul 3, 2025

Copy link
Copy Markdown
Member Author

Thanks!

cell_id = if cell_id_parsed isa UUID
if haskey(collected_cells, cell_id_parsed)
@warn "Cell ID appears multiple times in the file. Generating a new one."
uuid1()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would return statements help clarify the code here?

Comment thread src/notebook/saving and loading.jl
Comment thread src/notebook/saving and loading.jl
@fonsp fonsp merged commit 939d900 into main Aug 1, 2025
10 of 14 checks passed
@fonsp fonsp deleted the more-stable-notebook-cell-order-parsing branch August 1, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants