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

Convert Pluto notebooks to plain Julia code #432

Closed
leios opened this issue Sep 14, 2020 · 1 comment
Closed

Convert Pluto notebooks to plain Julia code #432

leios opened this issue Sep 14, 2020 · 1 comment

Comments

@leios
Copy link

leios commented Sep 14, 2020

Would it be possible to create a function that strips the Pluto-ness from a Pluto notebook and provides a simple julia file? Sometimes it's hard to get a notebook open to debug code.

As a note, I realize there are PlutoUI bits that might make this difficult.

Also: I realize Pluto notebooks are julia files, and can just write the script myself. I am mainly asking to remove the md and comments that look like this # ╔═╡ 0316b94c-eef6-11ea-19bc-dbc959901bb5

@fonsp
Copy link
Owner

fonsp commented Sep 14, 2020

We were discussing it today: fonsp/PlutoUtils.jl#11

Feel free to write this script yourself! Shouldn't be too tricky - delete any line that starts with one of the delimiters, and maybe also the line before it.

PlutoUI and @bind are designed to "work" without Pluto, as far as this is possible. Notebooks that use @bind include a mock version of the macro, which just assigns the default value of the input element to the variable. The default default value is missing, but types can ovverride this. The elements from PlutoUI all have sensible defaults.

For example, if your notebook contains

@bind x PlutoUI.Slider(5:15)

and you run the notebook without Pluto, then x will be assigned 5.

(There is nothing special about PlutoUI - it's just a small package that generates HTML strings, together with those defaults.)

@fonsp fonsp changed the title No way to convert Pluto notebooks to plain Julia code Convert Pluto notebooks to plain Julia code Sep 14, 2020
@fonsp fonsp closed this as completed Sep 14, 2020
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

2 participants