parent
3b074c185c
commit
aa03a7fec5
|
@ -56,10 +56,10 @@ pub struct Config {
|
||||||
translations: HashMap<String, languages::TranslateTerm>,
|
translations: HashMap<String, languages::TranslateTerm>,
|
||||||
|
|
||||||
/// Whether to highlight all code blocks found in markdown files. Defaults to false
|
/// 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
|
/// Which themes to use for code highlighting. See Readme for supported themes
|
||||||
/// Defaults to "base16-ocean-dark"
|
/// Defaults to "base16-ocean-dark"
|
||||||
pub highlight_theme: String,
|
highlight_theme: String,
|
||||||
|
|
||||||
/// Whether to generate a feed. Defaults to false.
|
/// Whether to generate a feed. Defaults to false.
|
||||||
pub generate_feed: bool,
|
pub generate_feed: bool,
|
||||||
|
|
|
@ -18,7 +18,7 @@ lazy_static! {
|
||||||
|
|
||||||
/// Returns the highlighter and whether it was found in the extra or not
|
/// 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) {
|
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;
|
let mut in_extra = false;
|
||||||
|
|
||||||
if let Some(ref lang) = language {
|
if let Some(ref lang) = language {
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub struct CodeBlock<'config> {
|
||||||
impl<'config> CodeBlock<'config> {
|
impl<'config> CodeBlock<'config> {
|
||||||
pub fn new(fence_info: &str, config: &'config Config, background: IncludeBackground) -> Self {
|
pub fn new(fence_info: &str, config: &'config Config, background: IncludeBackground) -> Self {
|
||||||
let fence_info = FenceSettings::new(fence_info);
|
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);
|
let (highlighter, in_extra) = get_highlighter(fence_info.language, config);
|
||||||
Self {
|
Self {
|
||||||
highlighter,
|
highlighter,
|
||||||
|
|
Loading…
Reference in a new issue