Auto merge of #37763 - liigo:rustdoc-playground, r=alexcrichton
rustdoc: add cli argument `--playground-url` Add a new cli argument `--playground-url` for rustdoc: `rustdoc lib.rs --playground-url="https://play.rust-lang.org/"` `rustdoc book.md --playground-url="https://play.rust-lang.org/"` This makes it possible for tools like https://docs.rs to generate crate docs that can submit samples code to run at https://play.rust-lang.org, even if the crate's author *forgot* putting `#![doc(html_playground_url = "https://play.rust-lang.org/")]` to crate root. By the way, I'd like to say, many crate authors are not aware of existing of `#![doc(html_playground_url = "https://play.rust-lang.org/")]`. `--playground-url` may be reset by `--markdown-playground-url` or `#![doc(html_playground_url=...)]`, so it's backward compatible. @alexcrichton since you implemented playground-url related features.
This commit is contained in:
@@ -467,10 +467,8 @@ pub fn run(mut krate: clean::Crate,
|
||||
clean::NameValue(ref x, ref s)
|
||||
if "html_playground_url" == *x => {
|
||||
markdown::PLAYGROUND.with(|slot| {
|
||||
if slot.borrow().is_none() {
|
||||
let name = krate.name.clone();
|
||||
*slot.borrow_mut() = Some((Some(name), s.clone()));
|
||||
}
|
||||
let name = krate.name.clone();
|
||||
*slot.borrow_mut() = Some((Some(name), s.clone()));
|
||||
});
|
||||
}
|
||||
clean::NameValue(ref x, ref s)
|
||||
|
||||
Reference in New Issue
Block a user