ink-playground
ink-playground copied to clipboard
Support running code from crate docs
Rustdoc supports a feature for defining a playground URL:
#![doc(html_playground_url = "https://playground.example.com/")]
https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#html_playground_url
We can use this feature to have a "Run" button show up in our ink! crate docs for example code:

Once the button is clicked the playground URL is opened with a GET parameter code and edition. The information that's missing for us is the version of ink! that the request originates from.
We can work around this by implementing https://github.com/paritytech/ink-playground/issues/427 and then setting something like
#![doc(html_playground_url = "https://ink-playground.substrate.io/v3.3.1/")]