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

Support running code from crate docs #428

@cmichi

Description

@cmichi

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/")]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions