Gaohaoyang / gaohaoyang.github.io

blog & blog theme🤘
http://gaohaoyang.github.io
MIT License
1.9k stars 2.01k forks source link

Can't serve the website. "Conversion Error" #139

Closed Cloufish closed 4 years ago

Cloufish commented 4 years ago

Hey I can't serve the website. Here's my output:

 sudo docker run --rm --volume="$PWD:/srv/jekyll" -p 4000:4000 jekyll/builder:4.0 jekyll serve

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-musl]
Configuration file: /srv/jekyll/_config.yml
            Source: /srv/jekyll
       Destination: /srv/jekyll/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2015-04-06-arrays-similar.md':
                    Rouge::Guesser::Ambiguous
                    ------------------------------------------------
      Jekyll 4.0.1   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
                    ------------------------------------------------
/usr/gem/gems/rouge-3.19.0/lib/rouge/lexer.rb:181:in `guess': Ambiguous guess: can't decide between ["xml", "html"] (Rouge::Guesser::Ambiguous)
        from /usr/gem/gems/rouge-3.19.0/lib/rouge/lexer.rb:82:in `find_fancy'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/syntax_highlighter/rouge.rb:29:in `call'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter.rb:46:in `block (2 levels) in <module:Converter>'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/base.rb:197:in `highlight_code'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/html.rb:115:in `convert_codeblock'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/html.rb:73:in `block in inner'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/html.rb:72:in `each'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/html.rb:72:in `inner'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/html.rb:373:in `convert_root'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/html.rb:60:in `convert'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/converter/base.rb:107:in `convert'
        from /usr/gem/gems/kramdown-2.2.1/lib/kramdown/document.rb:116:in `method_missing'
        from /usr/gem/gems/jekyll-4.0.1/lib/jekyll/converters/markdown/kramdown_parser.rb:41:in `convert'
        from /usr/gem/gems/jekyll-4.0.1/lib/jekyll/converters/markdown.rb:86:in `block in convert'
        from /usr/gem/gems/jekyll-4.0.1/lib/jekyll/cache.rb:111:in `rescue in getset'
        from /usr/gem/gems/jekyll-4.0.1/lib/jekyll/cache.rb:108:in `getset'
   [      AND SO ON        ] 

Is it related to running jekyll version 4.0? I don't want to make random guesses. Please help :/

Edit: Installing kramdown did not solve the issue

SOLUTION:

The issue was still related to kramdown. It expects ":default_lang" option in these cases.

WORKAROUND:

In the config file, pass "plaintext" as the :default_lang for syntax-highlighting as follows:

kramdown:
  syntax_highlighter_opts:
    default_lang: plaintext

Related issue to this one is here: https://github.com/jekyll/jekyll/issues/7858