Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Sep 20, 2016
Merged

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

merged 1 commit into from Sep 20, 2016

Conversation

ethomson
Copy link
Contributor

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

kramdown:
  syntax_highlighter: coderay
  syntax_highlighter_opts:
    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)

private
def modernize_coderay_config
if highlighter == "coderay"
if !@config["coderay"].empty?
Copy link
Member

@pathawks pathawks Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure; fixed.

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
present.
Copy link
Member

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

parkr commented Sep 20, 2016

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

@parkr parkr added this to the 3.3 milestone Sep 20, 2016
@parkr
Copy link
Member

parkr commented Sep 20, 2016

@jekyllbot: merge +buf

@jekyllbot jekyllbot merged commit cfe6177 into jekyll:master Sep 20, 2016
jekyllbot added a commit that referenced this pull request Sep 20, 2016
parkr added a commit that referenced this pull request Sep 21, 2016
@ethomson
Copy link
Contributor Author

Thanks @parkr ! ❤️

@jekyll jekyll locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants