From 215af5dc1e5236f4bff5d6a6401d4a473077de52 Mon Sep 17 00:00:00 2001 From: mlange-42 Date: Wed, 18 Jan 2023 12:38:46 +0100 Subject: [PATCH 01/14] use CSS to hide elements on certain themes --- src/book/init.rs | 3 +++ src/renderer/html_handlebars/hbs_renderer.rs | 1 + src/theme/css/exclude.css | 23 ++++++++++++++++++++ src/theme/mod.rs | 6 +++++ tests/init.rs | 1 + 5 files changed, 34 insertions(+) create mode 100644 src/theme/css/exclude.css diff --git a/src/book/init.rs b/src/book/init.rs index dd3fa8b0df..97dc88d4a1 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -143,6 +143,9 @@ impl BookBuilder { let mut variables_css = File::create(cssdir.join("variables.css"))?; variables_css.write_all(theme::VARIABLES_CSS)?; + let mut excludes_css = File::create(cssdir.join("exclude.css"))?; + excludes_css.write_all(theme::EXCLUDES_CSS)?; + let mut favicon = File::create(themedir.join("favicon.png"))?; favicon.write_all(theme::FAVICON_PNG)?; diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 1b648dac10..920a899e27 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -229,6 +229,7 @@ impl HtmlHandlebars { write_file(destination, "css/print.css", &theme.print_css)?; } write_file(destination, "css/variables.css", &theme.variables_css)?; + write_file(destination, "css/exclude.css", &theme.excludes_css)?; if let Some(contents) = &theme.favicon_png { write_file(destination, "favicon.png", contents)?; } diff --git a/src/theme/css/exclude.css b/src/theme/css/exclude.css new file mode 100644 index 0000000000..38e7321f05 --- /dev/null +++ b/src/theme/css/exclude.css @@ -0,0 +1,23 @@ +.light .no-light { + visibility: hidden; +} + +.rust .no-rust { + visibility: hidden; +} + +.navy .no-navy { + visibility: hidden; +} + +.ayu .no-ayu { + visibility: hidden; +} + +.coal .no-coal { + visibility: hidden; +} + +.navy, .ayu, .coal .no-dark { + visibility: hidden; +} diff --git a/src/theme/mod.rs b/src/theme/mod.rs index 7af5e2b701..dbc0c8b921 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -21,6 +21,7 @@ pub static CHROME_CSS: &[u8] = include_bytes!("css/chrome.css"); pub static GENERAL_CSS: &[u8] = include_bytes!("css/general.css"); pub static PRINT_CSS: &[u8] = include_bytes!("css/print.css"); pub static VARIABLES_CSS: &[u8] = include_bytes!("css/variables.css"); +pub static EXCLUDES_CSS: &[u8] = include_bytes!("css/exclude.css"); pub static FAVICON_PNG: &[u8] = include_bytes!("favicon.png"); pub static FAVICON_SVG: &[u8] = include_bytes!("favicon.svg"); pub static JS: &[u8] = include_bytes!("book.js"); @@ -54,6 +55,7 @@ pub struct Theme { pub general_css: Vec, pub print_css: Vec, pub variables_css: Vec, + pub excludes_css: Vec, pub favicon_png: Option>, pub favicon_svg: Option>, pub js: Vec, @@ -91,6 +93,7 @@ impl Theme { theme_dir.join("css/variables.css"), &mut theme.variables_css, ), + (theme_dir.join("css/exclude.css"), &mut theme.excludes_css), (theme_dir.join("highlight.js"), &mut theme.highlight_js), (theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js), (theme_dir.join("highlight.css"), &mut theme.highlight_css), @@ -153,6 +156,7 @@ impl Default for Theme { general_css: GENERAL_CSS.to_owned(), print_css: PRINT_CSS.to_owned(), variables_css: VARIABLES_CSS.to_owned(), + excludes_css: EXCLUDES_CSS.to_owned(), favicon_png: Some(FAVICON_PNG.to_owned()), favicon_svg: Some(FAVICON_SVG.to_owned()), js: JS.to_owned(), @@ -213,6 +217,7 @@ mod tests { "css/general.css", "css/print.css", "css/variables.css", + "css/exclude.css", "book.js", "highlight.js", "tomorrow-night.css", @@ -240,6 +245,7 @@ mod tests { general_css: Vec::new(), print_css: Vec::new(), variables_css: Vec::new(), + excludes_css: Vec::new(), favicon_png: Some(Vec::new()), favicon_svg: Some(Vec::new()), js: Vec::new(), diff --git a/tests/init.rs b/tests/init.rs index 1c3b962b5c..c429f3b16c 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -119,6 +119,7 @@ fn copy_theme() { "css/general.css", "css/print.css", "css/variables.css", + "css/exclude.css", "favicon.png", "favicon.svg", "highlight.css", From 83f190bed4b7896bce3a37c0a3d43038fb073d88 Mon Sep 17 00:00:00 2001 From: mlange-42 Date: Wed, 18 Jan 2023 13:01:43 +0100 Subject: [PATCH 02/14] tweak exclusion css, include in page --- src/theme/css/exclude.css | 21 ++++++++++++++------- src/theme/index.hbs | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/theme/css/exclude.css b/src/theme/css/exclude.css index 38e7321f05..19f0a54062 100644 --- a/src/theme/css/exclude.css +++ b/src/theme/css/exclude.css @@ -1,23 +1,30 @@ .light .no-light { - visibility: hidden; + display: none; } .rust .no-rust { - visibility: hidden; + display: none; +} + +.light .no-light-themes, +.rust .no-light-themes { + display: none; } .navy .no-navy { - visibility: hidden; + display: none; } .ayu .no-ayu { - visibility: hidden; + display: none; } .coal .no-coal { - visibility: hidden; + display: none; } -.navy, .ayu, .coal .no-dark { - visibility: hidden; +.navy .no-dark-themes, +.ayu .no-dark-themes, +.coal .no-dark-themes { + display: none; } diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 147eb9af2d..d516414601 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -28,6 +28,7 @@ + {{#if print_enable}} {{/if}} From 213ed826405b38ae9f10812d58c7569bee701c4c Mon Sep 17 00:00:00 2001 From: mlange-42 Date: Wed, 18 Jan 2023 13:19:16 +0100 Subject: [PATCH 03/14] document the new feature --- .../src/format/images/rust-logo-blk-dark.svg | 1 + guide/src/format/markdown.md | 22 +++++++++++++++++++ guide/src/format/theme/README.md | 1 + 3 files changed, 24 insertions(+) create mode 100644 guide/src/format/images/rust-logo-blk-dark.svg diff --git a/guide/src/format/images/rust-logo-blk-dark.svg b/guide/src/format/images/rust-logo-blk-dark.svg new file mode 100644 index 0000000000..9f108d661d --- /dev/null +++ b/guide/src/format/images/rust-logo-blk-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/guide/src/format/markdown.md b/guide/src/format/markdown.md index 963a1538c2..0bf1ce2492 100644 --- a/guide/src/format/markdown.md +++ b/guide/src/format/markdown.md @@ -117,6 +117,28 @@ Which, of course displays the image like so: ![The Rust Logo](images/rust-logo-blk.svg) +## Theme-dependent images + +Image variants for different themes can be used via CSS classes. + +Here is an example for different images for light vs. dark themes: + +```markdown + + +``` + +Try switching the theme to see the effect below (brush icon at the top left of the page): + + + + +To exclude an image (or any HTML element) for all dark or all light themes +(incl. the Rust theme), use the classes `no-dark-themes` and `no-light-themes`. + +For even more control, elements can be hidden on an individual theme basis using the classes +`no-light`, `no-rust`, `no-coal`, `no-navy` and `no-ayu`. + ## Extensions mdBook has several extensions beyond the standard CommonMark specification. diff --git a/guide/src/format/theme/README.md b/guide/src/format/theme/README.md index 4a776e6084..1d875945a7 100644 --- a/guide/src/format/theme/README.md +++ b/guide/src/format/theme/README.md @@ -18,6 +18,7 @@ Here are the files you can override: - **_css/chrome.css_** is for UI elements. - **_css/general.css_** is the base styles. - **_css/print.css_** is the style for printer output. + - **_css/exclude.css_** is for [theme-dependent images](../markdown.md#theme-dependent-images). - **_css/variables.css_** contains variables used in other CSS files. - **_book.js_** is mostly used to add client side functionality, like hiding / un-hiding the sidebar, changing the theme, ... From a78c44f18202aa3f1c134cba7a7ea510be89c085 Mon Sep 17 00:00:00 2001 From: mlange-42 Date: Wed, 18 Jan 2023 13:31:08 +0100 Subject: [PATCH 04/14] format css, tweak example image --- .../src/format/images/rust-logo-blk-dark.svg | 2 +- src/theme/css/exclude.css | 22 +++++-------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/guide/src/format/images/rust-logo-blk-dark.svg b/guide/src/format/images/rust-logo-blk-dark.svg index 9f108d661d..c56a2cc91d 100644 --- a/guide/src/format/images/rust-logo-blk-dark.svg +++ b/guide/src/format/images/rust-logo-blk-dark.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/theme/css/exclude.css b/src/theme/css/exclude.css index 19f0a54062..9847b1b831 100644 --- a/src/theme/css/exclude.css +++ b/src/theme/css/exclude.css @@ -1,8 +1,8 @@ -.light .no-light { - display: none; -} - -.rust .no-rust { +.light .no-light, +.rust .no-rust, +.navy .no-navy, +.ayu .no-ayu, +.coal .no-coal { display: none; } @@ -11,18 +11,6 @@ display: none; } -.navy .no-navy { - display: none; -} - -.ayu .no-ayu { - display: none; -} - -.coal .no-coal { - display: none; -} - .navy .no-dark-themes, .ayu .no-dark-themes, .coal .no-dark-themes { From dafc430b5f425b6069d3105568d5cacb316cc5ee Mon Sep 17 00:00:00 2001 From: mlange-42 Date: Wed, 18 Jan 2023 13:44:12 +0100 Subject: [PATCH 05/14] fix copy_theme unit test --- tests/init.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/init.rs b/tests/init.rs index c429f3b16c..15d6ecefd4 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -116,10 +116,10 @@ fn copy_theme() { let expected = vec![ "book.js", "css/chrome.css", + "css/exclude.css", "css/general.css", "css/print.css", "css/variables.css", - "css/exclude.css", "favicon.png", "favicon.svg", "highlight.css", From 0628921aaa56c101ddf53693aad53b8ace7119aa Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 13:11:35 -0400 Subject: [PATCH 06/14] =?UTF-8?q?=F0=9F=92=84=20Add=20image=20light/dark?= =?UTF-8?q?=20rules=20to=20`general.css`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/theme/css/general.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/theme/css/general.css b/src/theme/css/general.css index e7d20da725..b1d95ab6c1 100644 --- a/src/theme/css/general.css +++ b/src/theme/css/general.css @@ -146,6 +146,16 @@ table tbody tr:nth-child(2n) { background: var(--table-alternate-bg); } +.light img[src$="#only-dark"], +.rust img[src$="#only-dark"] { + display:none; +} + +.navy img[src$="#only-light"], +.ayu img[src$="#only-light"], +.coal img[src$="#only-light"] { + display:none; +} blockquote { margin: 20px 0; From 42e15fe898fa4dc6820f80b6ccda763a8ca84db4 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 13:20:15 -0400 Subject: [PATCH 07/14] =?UTF-8?q?=F0=9F=94=A5=20Drop=20`exclude.css`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/theme/css/exclude.css | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/theme/css/exclude.css diff --git a/src/theme/css/exclude.css b/src/theme/css/exclude.css deleted file mode 100644 index 9847b1b831..0000000000 --- a/src/theme/css/exclude.css +++ /dev/null @@ -1,18 +0,0 @@ -.light .no-light, -.rust .no-rust, -.navy .no-navy, -.ayu .no-ayu, -.coal .no-coal { - display: none; -} - -.light .no-light-themes, -.rust .no-light-themes { - display: none; -} - -.navy .no-dark-themes, -.ayu .no-dark-themes, -.coal .no-dark-themes { - display: none; -} From c42569b8d6b9ba1c7c2dfa772a0498cf44a53773 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 13:23:10 -0400 Subject: [PATCH 08/14] =?UTF-8?q?=F0=9F=9A=A8=20Drop=20references=20to=20e?= =?UTF-8?q?xtra=20css=20file,=20fix=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/book/init.rs | 3 --- src/renderer/html_handlebars/hbs_renderer.rs | 1 - src/theme/mod.rs | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/book/init.rs b/src/book/init.rs index 34dea2b700..faca1d09aa 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -144,9 +144,6 @@ impl BookBuilder { let mut variables_css = File::create(cssdir.join("variables.css"))?; variables_css.write_all(theme::VARIABLES_CSS)?; - let mut excludes_css = File::create(cssdir.join("exclude.css"))?; - excludes_css.write_all(theme::EXCLUDES_CSS)?; - let mut favicon = File::create(themedir.join("favicon.png"))?; favicon.write_all(theme::FAVICON_PNG)?; diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index f14abea67c..8ea2f49efc 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -244,7 +244,6 @@ impl HtmlHandlebars { write_file(destination, "css/print.css", &theme.print_css)?; } write_file(destination, "css/variables.css", &theme.variables_css)?; - write_file(destination, "css/exclude.css", &theme.excludes_css)?; if let Some(contents) = &theme.favicon_png { write_file(destination, "favicon.png", contents)?; } diff --git a/src/theme/mod.rs b/src/theme/mod.rs index fb3905edc1..6e6b509d12 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -21,7 +21,6 @@ pub static CHROME_CSS: &[u8] = include_bytes!("css/chrome.css"); pub static GENERAL_CSS: &[u8] = include_bytes!("css/general.css"); pub static PRINT_CSS: &[u8] = include_bytes!("css/print.css"); pub static VARIABLES_CSS: &[u8] = include_bytes!("css/variables.css"); -pub static EXCLUDES_CSS: &[u8] = include_bytes!("css/exclude.css"); pub static FAVICON_PNG: &[u8] = include_bytes!("favicon.png"); pub static FAVICON_SVG: &[u8] = include_bytes!("favicon.svg"); pub static JS: &[u8] = include_bytes!("book.js"); @@ -94,7 +93,6 @@ impl Theme { theme_dir.join("css/variables.css"), &mut theme.variables_css, ), - (theme_dir.join("css/exclude.css"), &mut theme.excludes_css), (theme_dir.join("highlight.js"), &mut theme.highlight_js), (theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js), (theme_dir.join("highlight.css"), &mut theme.highlight_css), From 3d4721fd96c52d3f419cbefc968ece833e64a591 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 13:24:43 -0400 Subject: [PATCH 09/14] =?UTF-8?q?=F0=9F=93=9D=20Document=20light/dark=20im?= =?UTF-8?q?ages=20in=20`markdown.md`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- guide/src/format/markdown.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/guide/src/format/markdown.md b/guide/src/format/markdown.md index b256f9f483..47b2f58142 100644 --- a/guide/src/format/markdown.md +++ b/guide/src/format/markdown.md @@ -2,13 +2,13 @@ mdBook's [parser](https://github.com/raphlinus/pulldown-cmark) adheres to the [CommonMark](https://commonmark.org/) specification with some extensions described below. You can take a quick [tutorial](https://commonmark.org/help/tutorial/), -or [try out](https://spec.commonmark.org/dingus/) CommonMark in real time. A complete Markdown overview is out of scope for +or [try out](https://spec.commonmark.org/dingus/) CommonMark in real time. A complete Markdown overview is out of scope for this documentation, but below is a high level overview of some of the basics. For a more in-depth experience, check out the [Markdown Guide](https://www.markdownguide.org). ## Text and Paragraphs -Text is rendered relatively predictably: +Text is rendered relatively predictably: ```markdown Here is a line of text. @@ -27,20 +27,20 @@ This is a new line. Headings use the `#` marker and should be on a line by themselves. More `#` mean smaller headings: ```markdown -### A heading +### A heading Some text. -#### A smaller heading +#### A smaller heading More text. ``` -### A heading +### A heading Some text. -#### A smaller heading +#### A smaller heading More text. @@ -71,14 +71,14 @@ Lists can be unordered or ordered. Ordered lists will order automatically: Linking to a URL or local file is easy: ```markdown -Use [mdBook](https://github.com/rust-lang/mdBook). +Use [mdBook](https://github.com/rust-lang/mdBook). Read about [mdBook](mdbook.md). A bare url: . ``` -Use [mdBook](https://github.com/rust-lang/mdBook). +Use [mdBook](https://github.com/rust-lang/mdBook). Read about [mdBook](mdbook.md). @@ -124,14 +124,14 @@ Image variants for different themes can be used via CSS classes. Here is an example for different images for light vs. dark themes: ```markdown - - +![rust logo standard edition](images/rust-logo-blk.svg#only-light) +![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) ``` Try switching the theme to see the effect below (brush icon at the top left of the page): - - +![rust logo standard edition](images/rust-logo-blk.svg#only-light) +![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) To exclude an image (or any HTML element) for all dark or all light themes (incl. the Rust theme), use the classes `no-dark-themes` and `no-light-themes`. From 5b320a3b35ab6c69b1c2bb0c15f650539157f7fa Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 13:29:44 -0400 Subject: [PATCH 10/14] =?UTF-8?q?=F0=9F=94=A5=20Drop=20references=20to=20`?= =?UTF-8?q?exclude.css`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/theme/index.hbs | 1 - tests/init.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/theme/index.hbs b/src/theme/index.hbs index e18f489b4a..2ee58c62ee 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -28,7 +28,6 @@ - {{#if print_enable}} {{/if}} diff --git a/tests/init.rs b/tests/init.rs index 47f3260bc7..2b6ad507ce 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -117,7 +117,6 @@ fn copy_theme() { let expected = vec![ "book.js", "css/chrome.css", - "css/exclude.css", "css/general.css", "css/print.css", "css/variables.css", From 62ba466b676e8943b4cb6a4a132693947ddd3266 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 14:00:51 -0400 Subject: [PATCH 11/14] =?UTF-8?q?=F0=9F=93=9D=20Document=20how=20to=20use?= =?UTF-8?q?=20dark=20and=20light=20variants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- guide/src/format/markdown.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/guide/src/format/markdown.md b/guide/src/format/markdown.md index 47b2f58142..1f9b74f44d 100644 --- a/guide/src/format/markdown.md +++ b/guide/src/format/markdown.md @@ -117,11 +117,9 @@ Which, of course displays the image like so: ![The Rust Logo](images/rust-logo-blk.svg) -## Theme-dependent images +## Light and Dark Image Variants -Image variants for different themes can be used via CSS classes. - -Here is an example for different images for light vs. dark themes: +Separate light mode and dark mode images may be presented to the viewer by adding `#light-only` or `#dark-only` to an image path: ```markdown ![rust logo standard edition](images/rust-logo-blk.svg#only-light) @@ -133,12 +131,6 @@ Try switching the theme to see the effect below (brush icon at the top left of t ![rust logo standard edition](images/rust-logo-blk.svg#only-light) ![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) -To exclude an image (or any HTML element) for all dark or all light themes -(incl. the Rust theme), use the classes `no-dark-themes` and `no-light-themes`. - -For even more control, elements can be hidden on an individual theme basis using the classes -`no-light`, `no-rust`, `no-coal`, `no-navy` and `no-ayu`. - ## Extensions mdBook has several extensions beyond the standard CommonMark specification. From c05065a894412619b46fe2f92a4af297dacaa33b Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 14:28:40 -0400 Subject: [PATCH 12/14] =?UTF-8?q?=F0=9F=93=9D=20Drop=20mention=20of=20`exc?= =?UTF-8?q?lude.css`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This had incremental work toward an image variant solution --- guide/src/format/theme/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/guide/src/format/theme/README.md b/guide/src/format/theme/README.md index a4debf6fe8..23da5a0434 100644 --- a/guide/src/format/theme/README.md +++ b/guide/src/format/theme/README.md @@ -18,7 +18,6 @@ Here are the files you can override: - **_css/chrome.css_** is for UI elements. - **_css/general.css_** is the base styles. - **_css/print.css_** is the style for printer output. - - **_css/exclude.css_** is for [theme-dependent images](../markdown.md#theme-dependent-images). - **_css/variables.css_** contains variables used in other CSS files. - **_book.js_** is mostly used to add client side functionality, like hiding / un-hiding the sidebar, changing the theme, ... From 658699fea6d9253a933df35170f4d951046e0844 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 14:32:16 -0400 Subject: [PATCH 13/14] =?UTF-8?q?=E2=8F=AA=EF=B8=8F=20Revert=20"?= =?UTF-8?q?=F0=9F=93=9D=20Document=20light/dark=20images=20in=20`markdown.?= =?UTF-8?q?md`"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3d4721fd96c52d3f419cbefc968ece833e64a591. I'm trying to get the diffs smaller. It looks like someone previously committed code that did not strip extra spaces from the ends of lines with their editor. --- guide/src/format/markdown.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/guide/src/format/markdown.md b/guide/src/format/markdown.md index 1f9b74f44d..c2619113a6 100644 --- a/guide/src/format/markdown.md +++ b/guide/src/format/markdown.md @@ -2,13 +2,13 @@ mdBook's [parser](https://github.com/raphlinus/pulldown-cmark) adheres to the [CommonMark](https://commonmark.org/) specification with some extensions described below. You can take a quick [tutorial](https://commonmark.org/help/tutorial/), -or [try out](https://spec.commonmark.org/dingus/) CommonMark in real time. A complete Markdown overview is out of scope for +or [try out](https://spec.commonmark.org/dingus/) CommonMark in real time. A complete Markdown overview is out of scope for this documentation, but below is a high level overview of some of the basics. For a more in-depth experience, check out the [Markdown Guide](https://www.markdownguide.org). ## Text and Paragraphs -Text is rendered relatively predictably: +Text is rendered relatively predictably: ```markdown Here is a line of text. @@ -27,20 +27,20 @@ This is a new line. Headings use the `#` marker and should be on a line by themselves. More `#` mean smaller headings: ```markdown -### A heading +### A heading Some text. -#### A smaller heading +#### A smaller heading More text. ``` -### A heading +### A heading Some text. -#### A smaller heading +#### A smaller heading More text. @@ -71,14 +71,14 @@ Lists can be unordered or ordered. Ordered lists will order automatically: Linking to a URL or local file is easy: ```markdown -Use [mdBook](https://github.com/rust-lang/mdBook). +Use [mdBook](https://github.com/rust-lang/mdBook). Read about [mdBook](mdbook.md). A bare url: . ``` -Use [mdBook](https://github.com/rust-lang/mdBook). +Use [mdBook](https://github.com/rust-lang/mdBook). Read about [mdBook](mdbook.md). @@ -122,14 +122,14 @@ Which, of course displays the image like so: Separate light mode and dark mode images may be presented to the viewer by adding `#light-only` or `#dark-only` to an image path: ```markdown -![rust logo standard edition](images/rust-logo-blk.svg#only-light) -![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) + + ``` Try switching the theme to see the effect below (brush icon at the top left of the page): -![rust logo standard edition](images/rust-logo-blk.svg#only-light) -![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) + + ## Extensions From b2106554245a9e8587677ba6c6c5b6b464269c75 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sun, 22 Oct 2023 14:34:07 -0400 Subject: [PATCH 14/14] =?UTF-8?q?=F0=9F=93=9D=20Document=20the=20light=20a?= =?UTF-8?q?nd=20dark=20image=20variants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- guide/src/format/markdown.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/guide/src/format/markdown.md b/guide/src/format/markdown.md index c2619113a6..2a2bd3b748 100644 --- a/guide/src/format/markdown.md +++ b/guide/src/format/markdown.md @@ -117,19 +117,20 @@ Which, of course displays the image like so: ![The Rust Logo](images/rust-logo-blk.svg) + ## Light and Dark Image Variants Separate light mode and dark mode images may be presented to the viewer by adding `#light-only` or `#dark-only` to an image path: ```markdown - - +![rust logo standard edition](images/rust-logo-blk.svg#only-light) +![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) ``` Try switching the theme to see the effect below (brush icon at the top left of the page): - - +![rust logo standard edition](images/rust-logo-blk.svg#only-light) +![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark) ## Extensions