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

Way from julia and javascript to store metadata in notebook file #1482

Closed
dralletje opened this issue Sep 22, 2021 · 7 comments
Closed

Way from julia and javascript to store metadata in notebook file #1482

dralletje opened this issue Sep 22, 2021 · 7 comments
Assignees

Comments

@dralletje
Copy link
Collaborator

dralletje commented Sep 22, 2021

Soon we'll merge #1209 in, which will likely store a disabled field in the notebook in some way. We're going to need this more.

Specifically, I need it to eventually make an app-grid-builder UI, and it feels better to have those values stored with the cell, instead of separately in a # 0000000-... cell. That does still make sense for global values, less for cell-specifiek values, but for cell-specific values it feels better to store it next to the cell.

I'm thinking of "just" storing TOML:

# ╔═╡6a49a6ec-2a2a-42ce-8b20-c4773d02c235
# ╟─ my_config_value = true

This way it will support nesting, bare values, everything that TOML does!
And Julia people like TOML 😏

Fancier example, possibly with the tabletop-y ╢ thing even

# ╔═╡6a49a6ec-2a2a-42ce-8b20-c4773d02c235
# ╠═╡disabled = false
# ╠═╡[dral-app-config]
# ╠═╡page = frontpage
@fonsp
Copy link
Owner

fonsp commented Sep 22, 2021

@fonsp
Copy link
Owner

fonsp commented Sep 22, 2021

Looks good! Note that #1209 goes one step further by also commenting out the cell code when (indirectly) disabled.

@dralletje
Copy link
Collaborator Author

See also #421 and https://www.notion.so/malyvsen/Flexible-notebook-format-61749c09aa1b450fa79f025d725bef4c (nothing here yet)

I knew I didn't think of this by myself!!

@disberd
Copy link
Contributor

disberd commented Sep 23, 2021

Love this! It would open up so many more possibilities! :D

@fonsp
Copy link
Owner

fonsp commented Sep 27, 2021

@dralletje Started working on this, ( can you make a draft PR? https://github.com/fonsp/Pluto.jl/compare/metadata-in-notebook-file?expand=1 )

@lungben
Copy link
Contributor

lungben commented Feb 3, 2022

My suggestion for the scope of this issue:

  1. Add a field to Cell containing the metadata (as a Dict[String, Any})
  2. Write the content of the metadata field to the notebook.jl file
  3. Read the metatdata from the notebook.jl file and add it into the Cell metadata field
  4. Pass the Cell metadata field to the frontend (not required for saving / loading disable status of cells #1209 but this would allow other cool features like custom cell formatting)

Fons' code above already covers most of 2.+3.

What do you think?

@lungben
Copy link
Contributor

lungben commented Feb 4, 2022

I'll take a shot in #1895

@fonsp fonsp closed this as completed Mar 21, 2022
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

No branches or pull requests

4 participants