Config to toggle the run button on codeblocks
This commit is contained in:
parent
fa0f9df497
commit
b85c3035fe
|
@ -630,6 +630,8 @@ pub struct Playground {
|
||||||
pub copy_js: bool,
|
pub copy_js: bool,
|
||||||
/// Display line numbers on playground snippets. Default: `false`.
|
/// Display line numbers on playground snippets. Default: `false`.
|
||||||
pub line_numbers: bool,
|
pub line_numbers: bool,
|
||||||
|
/// Display the run button. Default: `true`
|
||||||
|
pub runnable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Playground {
|
impl Default for Playground {
|
||||||
|
@ -639,6 +641,7 @@ impl Default for Playground {
|
||||||
copyable: true,
|
copyable: true,
|
||||||
copy_js: true,
|
copy_js: true,
|
||||||
line_numbers: false,
|
line_numbers: false,
|
||||||
|
runnable: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,6 +784,7 @@ mod tests {
|
||||||
copyable: true,
|
copyable: true,
|
||||||
copy_js: true,
|
copy_js: true,
|
||||||
line_numbers: false,
|
line_numbers: false,
|
||||||
|
runnable: true,
|
||||||
};
|
};
|
||||||
let html_should_be = HtmlConfig {
|
let html_should_be = HtmlConfig {
|
||||||
curly_quotes: true,
|
curly_quotes: true,
|
||||||
|
|
|
@ -828,7 +828,8 @@ fn add_playground_pre(
|
||||||
if classes.contains("language-rust") {
|
if classes.contains("language-rust") {
|
||||||
if (!classes.contains("ignore")
|
if (!classes.contains("ignore")
|
||||||
&& !classes.contains("noplayground")
|
&& !classes.contains("noplayground")
|
||||||
&& !classes.contains("noplaypen"))
|
&& !classes.contains("noplaypen")
|
||||||
|
&& playground_config.runnable)
|
||||||
|| classes.contains("mdbook-runnable")
|
|| classes.contains("mdbook-runnable")
|
||||||
{
|
{
|
||||||
let contains_e2015 = classes.contains("edition2015");
|
let contains_e2015 = classes.contains("edition2015");
|
||||||
|
|
Loading…
Reference in New Issue