Browse Source

Fix incorrect default for highlight_code of Config

index-subcmd
Vincent Prouillet 6 years ago
parent
commit
f100d956c6
3 changed files with 9 additions and 4 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +1
    -1
      components/config/src/lib.rs
  3. +6
    -3
      components/rendering/tests/markdown.rs

+ 2
- 0
CHANGELOG.md View File

@@ -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)



+ 1
- 1
components/config/src/lib.rs View File

@@ -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,


+ 6
- 3
components/rendering/tests/markdown.rs View File

@@ -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


Loading…
Cancel
Save