From 0821440288285a719f76200bdc3b4539440d1cb0 Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 26 Jul 2018 13:30:33 +0100 Subject: [PATCH] Fancier markdown escaping --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e993b27..a7378a3 100644 --- a/README.md +++ b/README.md @@ -92,22 +92,22 @@ no Rust syntax highlighting and testing. So the below is not tested by Skeptic. -``` +```` ``` let this_is_not_going_to_be_compiled_and_run = @all; It doesn't really matter what's in here. ``` -``` +```` To indicate Rust code, code blocks are labeled `rust`: -```rust +````rust,ignore ```rust fn main() { println!("Calm your skepticism. This example is verified."); } ``` -``` +```` Skeptic will interpret other words in the code block's 'info string' (which should be separated by comma, `,`, to be @@ -121,13 +121,13 @@ be compiled or run during testing. This can be useful if an example is written in Rust (and you want it highlighted as such) but it is known to be incomplete (so it cannot compile as-is). -```rust,ignore +````rust,ignore ```rust,ignore fn do_amazing_thing() -> i32 { // TODO: How do I do this? unimplemented! whatever I'm distracted, oh cookies! ``` -``` +```` ### `no_run` Info String @@ -136,7 +136,7 @@ Code marked with `no_run` will however still be compiled. This is useful for examples/test that may have side effects or dependencies which are not desirable in a testing situation. -```rust,no_run +````rust,ignore ```rust,no_run fn do_amazing_thing() -> i32 { // TODO: How do I do this? @@ -147,20 +147,20 @@ fn main() { do_amazing_thing(); } ``` -``` +```` ### `should_panic` Info String `should_panic` causes the test to only pass if it terminates because of a `panic!()`. -```rust,should_panic +````rust,ignore ```rust,should_panic fn main() { assert!(1 == 100); } ``` -``` +```` ## Skeptic Templates @@ -197,27 +197,27 @@ This example won't compile without defining `main` and importing boilerplate. Instead it is annotated `skt-foo`, for _skeptic template foo_, like so: -```rust,skt-foo +````rust,ignore ```rust,skt-foo let p = PathBuf::from("foo"); println!("{:?}", p); ``` -``` +```` This tells skeptic to look in the template file for another markdown block with the same `skt-foo` annotation, and compose them together using the standard Rust `format!` macro. Here's what the template looks like: -```rust,skt-foo -```rust,ignore +````rust,ignore +```rust,skt-foo use std::path::PathBuf; fn main() {{ {} }} ``` -``` +```` Templates are [Rust format specifiers](http://doc.rust-lang.org/std/fmt/index.html) that must @@ -233,15 +233,15 @@ Within a document, a `rust` code block tagged `skeptic-template` will be used as the template for all examples in the doc that are not explicitly tagged. -```rust,skeptic-template -```rust,ignore +````rust,ignore +```rust,skeptic-template use std::path::PathBuf; fn main() {{ {} }} ``` -``` +```` ## Rustdoc-style undisplayed lines with `# `