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

Make JuliaFormatter ignore bind macro in notebook file #3072

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/notebook/saving and loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ function save_notebook(io::IO, notebook::Notebook)
# Super Advanced Code Analysis™ to add the @bind macro to the saved file if it's used somewhere.
if any(!must_be_commented_in_file(c) && occursin("@bind", c.code) for c in notebook.cells)
println(io, "")
println(io, "#! format: off") # Turn off formatting. See https://domluna.github.io/JuliaFormatter.jl/stable/#Turn-off/on-formatting
println(io, "# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).")
println(io, PlutoRunner.fake_bind)
println(io, "#! format: on") # Turn formatting back on.
end
println(io)

Expand Down
Loading