From 6dc824257ad36ce44cd41340a1b0cd87b78dfaf7 Mon Sep 17 00:00:00 2001 From: mandeep Date: Thu, 17 May 2018 21:15:32 -0500 Subject: [PATCH 1/2] Add doc comment to hiding portions of code example Refactor hiding example to be more complete --- src/doc/rustdoc/src/documentation-tests.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index 3098587a8a4cc..eb5c53f899bab 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -79,8 +79,9 @@ from your example, but are important to make the tests work. Consider an example block that looks like this: ```text -/// Some documentation. -# fn foo() {} +/// /// Some documentation. +/// # fn foo() {} // this function will be hidden +/// println!("Hello, World!"); ``` It will render like this: From 8d74cf870557b42902274f5b898f8aa3117eb47c Mon Sep 17 00:00:00 2001 From: mandeep Date: Fri, 18 May 2018 10:06:20 -0500 Subject: [PATCH 2/2] Add println statement to rendered code block example --- src/doc/rustdoc/src/documentation-tests.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index eb5c53f899bab..2941ae16a58e1 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -89,6 +89,7 @@ It will render like this: ```rust /// Some documentation. # fn foo() {} +println!("Hello, World!"); ``` Yes, that's right: you can add lines that start with `# `, and they will