Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Submit examples to play.rust-lang.org #14700

Closed
wants to merge 2 commits into from

Conversation

alexcrichton
Copy link
Member

This grows a new option inside of rustdoc to add the ability to submit examples
to an external website. If the --markdown-playground-url command line option
or crate doc attribute html_playground_url is present, then examples will have
a button on hover to submit the code to the playground specified.

This commit enables submission of example code to play.rust-lang.org. The code
submitted is that which is tested by rustdoc, not necessarily the exact code
shown in the example.

These were only used for the markdown tests, and there's no reason they should
be distinct from the other tests.
@alexcrichton
Copy link
Member Author

if (window.playgroundUrl) {
$('pre.rust').hover(function() {
var klass = $(this).attr('class').replace('rust ', '');
var a = $('<a>').text('⇱').attr('class', 'test-arrow');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I think this arrow is pointing the "wrong" way for being in the top-right corner, also it's not immediately obvious: it could have text like "edit" or "edit & run" too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. For now I managed to find some css to flip the arrow so it's pointing in the right direction (I couldn't find the unicode character for that), but someone with a real eye for design should probably look at this at some point.

This grows a new option inside of rustdoc to add the ability to submit examples
to an external website. If the `--markdown-playground-url` command line option
or crate doc attribute `html_playground_url` is present, then examples will have
a button on hover to submit the code to the playground specified.

This commit enables submission of example code to play.rust-lang.org. The code
submitted is that which is tested by rustdoc, not necessarily the exact code
shown in the example.

Closes rust-lang#14654
@huonw
Copy link
Member

huonw commented Jun 7, 2014

r=me with nits.

@alexcrichton
Copy link
Member Author

Thanks @huonw!

@bors bors closed this in e87e180 Jun 7, 2014
@alexcrichton alexcrichton deleted the rustdoc-playpen branch June 7, 2014 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants