mfenner / jekyll-pandoc

Jekyll Pandoc markdown converter as Ruby gem
MIT License
82 stars 10 forks source link

Trying to use jekyll-pandoc with jekyll 4. #15

Open lakonis opened 3 years ago

lakonis commented 3 years ago

I followed instructions (GEMFILE, bundle install, _config.yaml), but the build seems to not recognise Pandoc as markdown processor.

Markdown processor: "Pandoc" is not a valid Markdown processor.
                    Available processors are: kramdown

  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_portfolio/example.md':
                    Invalid Markdown processor given: Pandoc
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    Invalid Markdown processor given: Pandoc
> bundle info jekyll
  * jekyll (4.1.1)
    Summary: A simple, blog aware, static site generator.
    Homepage: https://jekyllrb.com
    Path: /home/me/gems/gems/jekyll-4.1.1
> bundle info jekyll-pandoc
  * jekyll-pandoc (2.0.1)
    Summary: Jekyll Pandoc markdown converter
    Homepage: https://github.com/mfenner/jekyll-pandoc
    Path: /home/me/gems/gems/jekyll-pandoc-2.0.1
p3palazzo commented 3 years ago

Works for me with Jekyll 4.2.0 and Pandoc 2.11.3.2. What does your _config.yaml look like? Are you building with bundle exec jekyll build? I have a working docker image with this setup at palazzo/jekyll-pandoc:4.2.0:2.11.3.2 in case you're interested.

Matttthias commented 3 years ago

Actually I have exactly the same problem as user lakonis.

  1. Setup entirely new virtual Machine based on Ubuntu 20.04.01 LTS
  2. Installed ruby from ubuntu sources ("ruby -v" ruby 2.7.0, "gem -v" ruby-gem 3.1.2)
  3. Installed jekyll exactly as instructed per jekyll website ("jekyll -v" jekyll 4.2.0)
  4. Installed pandoc from ubuntu sources ("pandoc -v" pandoc 2.5)
  5. Generated new website project for jekyll
  6. Followed instructions to install jekyll-pandoc as specified here on Git-Hub
  7. Executed both "jekyll -b" and "bundle exec jekyll build" and got same failure message as user lakonis

possibly interesting snippet from the given trace-output "gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:24:in `setup': Invalid Markdown processor given: Pandoc (Jekyll::Errors::FatalException)"

When looking into this file then the condition check "self.class ..." seems to fail finding Pandoc Converter class.

def custom_class_allowed?(parser_name)
        parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(parser_name.to_sym)
end

gemfile.lock includes

       jekyll-pandoc (2.0.1)
         jekyll (>= 3.0)
         pandoc-ruby (~> 2.0, >= 2.0.0)

and

pandoc-ruby (2.1.4)

The _config.yaml is exactly the one as generated with a new project + the changes as instructed here on Git-Hub for jekyll-pandoc.

Since I am not an expert neither in ruby nor in unix nor with docker I have left it there for now.

Matttthias commented 3 years ago

Likely found the culprit, was thinking that some change in Jekyll caused the behaviour, since for whatever reasons jekyll-pandoc does not seem to get loaded to jekyll as class is not found.

Went back and installed Jekyll 3.8.6 via gemfile. Building with pandoc worked there. Checked for differences and there was a change that items like jekyll-pandoc have to be announced by the keyword "plugins:" instead of "gems:" within the _config.yaml

Again installed fresh machine and put in the _config.yaml

plugins:
  - jekyll-pandoc

and it worked, thats it. Seems jekyll-pandoc is not really maintained anymore, when such a simple item went unnoticed for such a long period of time.

By the way the extensions to be put to _config.yaml for pandoc do not work anymore too, seemingly due to ongoing development of pandoc.

Please update the instructions on this page how to install jekyll-pandoc

mhoehle commented 2 years ago

By the way the extensions to be put to _config.yaml for pandoc do not work anymore too, seemingly due to ongoing development of pandoc.

I ran into a similar problem when using the package together with pandoc 2.18. In particular the extension "bibliography" does not work as before. However, when I added the additional extension "citeproc" it worked again, i.e.

    pandoc:
      extensions:
        - mathjax
        - bibliography: bibliography/references.bib
        - citeproc

Maybe this could be added in the documentation?