scribble
scribble copied to clipboard
Make examples easier to modify
Feature request from RacketCon: make it easy to copy/paste examples from scribble/examples.
The problem is that the code snippets in "Examples:" often need some context in order to run, so you can't just copy/paste from the docs to start experimenting with the examples.
One solution: add a "copy to clipboard" button to every codeblock made from an @examples[....]
Oh god yes please. Were you also thinking that the examples form could look at the bindings of all identifiers used and automatically include the needed (require ...) form?
There might be weirdness related to whether the user pastes the codeblock into a module or the repl, but that's still much better than how things are now.
Were you also thinking that the examples form could look at the bindings of all identifiers used and automatically include the needed (require ...) form?
Yes. Also any definitions from prior examples.
The evaluator has to get all this code to work (requires, defines), so I'm thinking we just need a way to record & replay the source code.
Please make this a backwards-compatible change. I don’t want the examples in HtDP/2e to reveal the source definitions because they are not (always) in *SL.
Maybe we can use a parameter so that both cases can be handled, that defaults to copy/pastable?
I think too that would be very useful thing to have.