Only complain about `kramdown.coderay` if it is actually in the config #5380

merged 1 commit into from Sep 20, 2016


None yet

4 participants


After upgrading to jekyll 3, I wanted to continue using coderay as my highlighter. So I updated my configuration to:

  syntax_highlighter: coderay
    line_numbers: inline
    css: class

And I was surprised when jekyll complained:

Deprecation: You are using 'kramdown.coderay' in your configuration, please use 'syntax_highlighter_opts' instead.

It seems that jekyll is raising this notice whenever highlighter == "coderay", even when the kramdown.coderay configuration setting is nonexistent.

Switching this to check for a non-empty kramdown.coderay hash keeps this warning when the user has kramdown.coderay settings, but suppresses this warning when the configuration has switched to the new style kramdown.syntax_highlighter_opts.

@@ -104,7 +104,7 @@ def strip_coderay_prefix(hash)
def modernize_coderay_config
- if highlighter == "coderay"
+ if !@config["coderay"].empty?
pathawks Sep 19, 2016 edited Member

I can't speak to the wider implications of this change, but as far as style goes, could we use unless instead of if !?
I think Rubocop should be complaining about this.

Edit: Sure enough.

ethomson Sep 19, 2016 Contributor

Sure; fixed.

@ethomson ethomson Only complain about `coderay` if it is actually in the config
Don't complain about the deprecated `kramdown.coderay` key when
`highlighter == "coderay"`, since that could have been set with the
legitimate `syntax_highlighter: coderay` setting.  Instead, complain
only if the `kramdown.coderay` configuration setting is actually
parkr approved these changes Sep 20, 2016 View changes

Thanks, @ethomson! This LGTM. If I'm following the logic properly, then this message will only fire if the coderay configuration key is present with some non-empty value. Seem right?

parkr commented Sep 20, 2016

Rubocop errors are fixed on master. We can merge without them.

@parkr parkr added bug fix labels Sep 20, 2016
@parkr parkr added this to the 3.3 milestone Sep 20, 2016
parkr commented Sep 20, 2016

@jekyllbot: merge +buf

@jekyllbot jekyllbot merged commit cfe6177 into jekyll:master Sep 20, 2016

0 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
continuous-integration/travis-ci/pr The Travis CI build failed
@parkr parkr added a commit that referenced this pull request Sep 21, 2016
@parkr parkr Move reference to #5380. 9ae0a70

Thanks @parkr ! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment