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

Can't find redcarpet 3.2 gem #812

Closed
mscharley opened this issue Nov 7, 2014 · 4 comments
Closed

Can't find redcarpet 3.2 gem #812

mscharley opened this issue Nov 7, 2014 · 4 comments

Comments

@mscharley
Copy link

$ yard -m markdown -M redcarpet
[error]: Missing 'redcarpet' gem for Markdown formatting. Install it with `gem install redcarpet`
$ gem list

*** LOCAL GEMS ***
redcarpet (3.2.0)
yard (0.8.7.6)
$ ruby --version
ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]

If I don't specify -M at all it seems to be falling back to rdoc even for markdown documentation files (redcarpet is the only markdown gem I have installed currently).

@mscharley
Copy link
Author

Seems to be an issue with redcarpet 3.2.0, yard works fine with 3.1.2. Will use 3.1 for now.

@mscharley mscharley changed the title Can't find redcarpet gem on MRI Can't find redcarpet 3.2 gem Nov 7, 2014
@andre-richter
Copy link

Redcarpet seems to fail for yard from time to time, which is unfortunate because it is the first entry in the MARKUP_PROVIDERS hash for markdown (in lib/yard/templates/helpers/markup_helper.rb)

MARKUP_PROVIDERS = {
        :markdown => [
          {:lib => :redcarpet, :const => 'RedcarpetCompat'},
          {:lib => :rdiscount, :const => 'RDiscount'},
          {:lib => :kramdown, :const => 'Kramdown::Document'},
          {:lib => :bluecloth, :const => 'BlueCloth'},
          {:lib => :maruku, :const => 'Maruku'},
          {:lib => :'rpeg-markdown', :const => 'PEGMarkdown'},
          {:lib => :rdoc, :const => 'YARD::Templates::Helpers::Markup::RDocMarkdown'},
        ],

That means if you invoke yard without any markdown provider installed, yard suggests the first entry from above hash/array, which is redcarpet.

# Show error message telling user to install first potential provider
        name, lib = *[providers.first[:const], providers.first[:lib] || type]
        log.error "Missing '#{lib}' gem for #{type.to_s.capitalize} formatting. Install it with `gem install #{lib}`"

User then installs redcarpet and is bugged with the error @mscharley showed, which is kind of a deadlock for most users, because they are not informed that there are multiple parsers to choose from.

I'd suggest to move the redcarpet entry in the markdown array a few places down, so that the user gets a suggestion for RDiscount or kramdown, which both work fine.

@lsegal
Copy link
Owner

lsegal commented Nov 25, 2014

I opened an issue for this backward incompatible change in upstream vmg/redcarpet#436 (the initial issue comes from vmg/redcarpet#401).

A temporary workaround would be to require 'redcarpet/compat' when invoking yard:

$ ruby -rredcarpet/compat -S yard ...

Not very fun, but it will do. I am considering moving redcarpet down in the priority list or removing it altogether depending on the outcome of the above patch.

@lsegal
Copy link
Owner

lsegal commented Nov 25, 2014

It looks like redcarpet released 3.2.1 which should resolve this issue.

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

No branches or pull requests

3 participants