Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Support running code from crate docs #428

Open
cmichi opened this issue Oct 5, 2022 · 0 comments
Open

Support running code from crate docs #428

cmichi opened this issue Oct 5, 2022 · 0 comments
Labels
enhancement New feature or request priority-medium

Comments

@cmichi
Copy link
Collaborator

cmichi commented Oct 5, 2022

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:

YTbMYaa

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 #427 and then setting something like

#![doc(html_playground_url = "https://ink-playground.substrate.io/v3.3.1/")]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request priority-medium
Projects
None yet
Development

No branches or pull requests

2 participants