From f100d956c67c6bd617739ae33ab2aa08912b4ac9 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Thu, 20 Sep 2018 20:07:20 +0200 Subject: [PATCH] Fix incorrect default for highlight_code of Config --- CHANGELOG.md | 2 ++ components/config/src/lib.rs | 2 +- components/rendering/tests/markdown.rs | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 770cd0cd..7ecf95fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ - Add more Emacs temp file to the ignored patterns in `gutenberg serve` - Files starting with `.` are not considered pages anymore even if they end with `.md` - `_processed_images` folder for image processing has been renamed `processed_images` to avoid issues with GitHub Pages +- Syntax highlighting default was mistakenly `true`, it has been set to `false` + ## 0.4.2 (2018-09-03) diff --git a/components/config/src/lib.rs b/components/config/src/lib.rs index d254d8d3..9bf23e9a 100644 --- a/components/config/src/lib.rs +++ b/components/config/src/lib.rs @@ -241,7 +241,7 @@ impl Default for Config { title: None, description: None, theme: None, - highlight_code: true, + highlight_code: false, highlight_theme: "base16-ocean-dark".to_string(), default_language: "en".to_string(), generate_rss: false, diff --git a/components/rendering/tests/markdown.rs b/components/rendering/tests/markdown.rs index a0ecc7ba..c9309130 100644 --- a/components/rendering/tests/markdown.rs +++ b/components/rendering/tests/markdown.rs @@ -43,7 +43,8 @@ fn doesnt_highlight_code_block_with_highlighting_off() { fn can_highlight_code_block_no_lang() { let tera_ctx = Tera::default(); let permalinks_ctx = HashMap::new(); - let config = Config::default(); + let mut config = Config::default(); + config.highlight_code = true; let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None); let res = render_content("```\n$ gutenberg server\n$ ping\n```", &context).unwrap(); assert_eq!( @@ -56,7 +57,8 @@ fn can_highlight_code_block_no_lang() { fn can_highlight_code_block_with_lang() { let tera_ctx = Tera::default(); let permalinks_ctx = HashMap::new(); - let config = Config::default(); + let mut config = Config::default(); + config.highlight_code = true; let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None); let res = render_content("```python\nlist.append(1)\n```", &context).unwrap(); assert_eq!( @@ -69,7 +71,8 @@ fn can_highlight_code_block_with_lang() { fn can_higlight_code_block_with_unknown_lang() { let tera_ctx = Tera::default(); let permalinks_ctx = HashMap::new(); - let config = Config::default(); + let mut config = Config::default(); + config.highlight_code = true; let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None); let res = render_content("```yolo\nlist.append(1)\n```", &context).unwrap(); // defaults to plain text