(credits to Michiel)
See a demo of this idea applied to observablehq (a JS notebook):
https://observablehq.com/@dralletje/functions-are-notebooks-with-inline-editing
and
https://observablehq.com/@dralletje/functions-are-notebooks-with-table-ui
Defining a subnotebook will feel like typing
greeter = sub
greeting = word * " " * name
md"with parameters"
word = "Hello"
name = "Hannes"
end
you can then use it like a function:
greeter().name == "Hello Hannes"
with replacements (like passing kwargs):
greeter(word="Hoi", name="Floep").name == "Hoi Floep"
You lose multiple dispatch
Notebooks within the same file is mostly fun, but importing other notebooks (.jl files) with replacement is very special - this is based on the same principle.
So regular notebooks would also need the @pluto_sub_insert
lines, maybe they can be combined with the cell delimiter stuff