Fix highlighting

Closes #1291
This commit is contained in:
Vincent Prouillet 2021-01-07 11:34:23 +01:00
parent 3b074c185c
commit aa03a7fec5
3 changed files with 4 additions and 4 deletions

View file

@ -56,10 +56,10 @@ pub struct Config {
translations: HashMap<String, languages::TranslateTerm>,
/// Whether to highlight all code blocks found in markdown files. Defaults to false
pub highlight_code: bool,
highlight_code: bool,
/// Which themes to use for code highlighting. See Readme for supported themes
/// Defaults to "base16-ocean-dark"
pub highlight_theme: String,
highlight_theme: String,
/// Whether to generate a feed. Defaults to false.
pub generate_feed: bool,

View file

@ -18,7 +18,7 @@ lazy_static! {
/// Returns the highlighter and whether it was found in the extra or not
pub fn get_highlighter(language: Option<&str>, config: &Config) -> (HighlightLines<'static>, bool) {
let theme = &THEME_SET.themes[&config.highlight_theme];
let theme = &THEME_SET.themes[config.highlight_theme()];
let mut in_extra = false;
if let Some(ref lang) = language {

View file

@ -24,7 +24,7 @@ pub struct CodeBlock<'config> {
impl<'config> CodeBlock<'config> {
pub fn new(fence_info: &str, config: &'config Config, background: IncludeBackground) -> Self {
let fence_info = FenceSettings::new(fence_info);
let theme = &THEME_SET.themes[&config.highlight_theme];
let theme = &THEME_SET.themes[config.highlight_theme()];
let (highlighter, in_extra) = get_highlighter(fence_info.language, config);
Self {
highlighter,