Gollum: Asciidoc Support Broken: no implicit conversion of nil into String.

Created on 30 Apr 2020  路  11Comments  路  Source: gollum/gollum

Describe the bug
When I clean-install (via bundler) Gollum and Asciidoctor I get an error when creating Asciidoc pages that reads: no implicit conversion of nil into String.

To Reproduce
Steps to reproduce the behavior:

  1. In an empty work directory...
  2. touch Gemfile
  3. bundle add gollum
  4. gem add asciidoctor
  5. bundle add asciidoctor
  6. git init a
  7. bundle exec gollum a
  8. Navigate to localhost:4567 and attempt to create a Home page of type Asciiidoc. Select preview to get the message. Images attached.

Expected behavior
A page be previewed and created.

Screenshots
error01

error02

Environment Info

bundle exec gollum --version
Gollum 5.0.1

Gemfiile.lock

  specs:
    asciidoctor (2.0.10)
    backports (3.17.1)
    concurrent-ruby (1.1.6)
    crass (1.0.6)
    execjs (2.7.0)
    ffi (1.12.2)
    gemojione (4.3.2)
      json
    github-markup (3.0.4)
    gollum (5.0.1)
      gemojione (~> 4.1)
      gollum-lib (~> 5.0)
      kramdown (~> 2.1.0)
      kramdown-parser-gfm (~> 1.0.0)
      mustache (>= 0.99.5, < 1.0.0)
      octicons (~> 8.5)
      rss (~> 0.2.9)
      sass (~> 3.5)
      sinatra (~> 2.0)
      sinatra-contrib (~> 2.0)
      sprockets (~> 3.7)
      sprockets-helpers (~> 1.2)
      therubyrhino (~> 2.1.0)
      uglifier (~> 3.2)
      useragent (~> 0.16.2)
    gollum-lib (5.0.3)
      gemojione (~> 4.1)
      github-markup (~> 3.0)
      gollum-rugged_adapter (~> 0.99.4, >= 0.99.4)
      loofah (~> 2.3)
      nokogiri (~> 1.8)
      octicons (~> 8.5)
      rouge (~> 3.1)
      twitter-text (= 1.14.7)
    gollum-rugged_adapter (0.99.6)
      mime-types (>= 1.15)
      rugged (~> 0.99)
    json (2.3.0)
    kramdown (2.1.0)
    kramdown-parser-gfm (1.0.1)
      kramdown (~> 2.0)
    loofah (2.5.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mime-types (3.3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2020.0425)
    mini_portile2 (2.4.0)
    multi_json (1.14.1)
    mustache (0.99.8)
    mustermann (1.1.1)
      ruby2_keywords (~> 0.0.1)
    nokogiri (1.10.9)
      mini_portile2 (~> 2.4.0)
    octicons (8.5.0)
      nokogiri (>= 1.6.3.1)
    rack (2.2.2)
    rack-protection (2.0.8.1)
      rack
    rb-fsevent (0.10.3)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    rexml (3.2.4)
    rouge (3.18.0)
    rss (0.2.9)
      rexml
    ruby2_keywords (0.0.2)
    rugged (0.99.0)
    sass (3.7.4)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sinatra (2.0.8.1)
      mustermann (~> 1.0)
      rack (~> 2.0)
      rack-protection (= 2.0.8.1)
      tilt (~> 2.0)
    sinatra-contrib (2.0.8.1)
      backports (>= 2.8.2)
      multi_json
      mustermann (~> 1.0)
      rack-protection (= 2.0.8.1)
      sinatra (= 2.0.8.1)
      tilt (~> 2.0)
    sprockets (3.7.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-helpers (1.3.0)
      sprockets (>= 2.2)
    therubyrhino (2.1.2)
      therubyrhino_jar (>= 1.7.4, < 1.7.9)
    therubyrhino_jar (1.7.8)
    tilt (2.0.10)
    twitter-text (1.14.7)
      unf (~> 0.1.0)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.7)
    useragent (0.16.10)

PLATFORMS
  ruby

DEPENDENCIES
  asciidoctor (~> 2.0)
  gollum (~> 5.0)

BUNDLED WITH
   2.1.4
asciidoc bug

Most helpful comment

Workaround if you installed gollum with gem instead of bundler:

gem install specific_install
gem specific_install 'https://github.com/github/markup.git'

All 11 comments

I can confirm the behavior.
```Running: Ruby version 2.6.3
Using:
rugged 0.99.0
gollum-rugged_adapter 0.99.4
gollum-lib 5.0.1
Markdown rendering gem: kramdown
Other renderering gems:
asciidoctor 2.0.10

Seems to be an issue with GitHub/Markup:

require 'github/markup'
require 'asciidoctor'
GitHub::Markup.render_s(:asciidoc, "= Hi")
# => TypeError: no implicit conversion of nil into String

Rings a bell. Looks like this might be the issue I addressed here? It seems like there hasn't been a bugfix release since then...

Correct. It's also been the last commit to the repo since then.

Using unreleased version fixed the issue for me.

gem 'github-markup', git: 'https://github.com/github/markup.git'

FYI I've sent an e-mail to github support about this, asking them to do a gem release, but no reply.

Workaround if you installed gollum with gem instead of bundler:

gem install specific_install
gem specific_install 'https://github.com/github/markup.git'

I worked around the issue by re-regeistering the handler for Asciidoc. I have to do this anyway because I want to run Asciidoctor as unsafe. Here's the code which looks, remarkably, nearly identical to what's bee linked or shared above. Maybe Gollum just docs this or embeds a workaround for now?

require 'github/markup'

module MyCompany
  module AsciiDocUnsafe
    def self.setup(base_dir)
      GitHub::Markup::markups.delete(::GitHub::Markups::MARKUP_ASCIIDOC)

      GitHub::Markup::markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content|

        attributes = {
          'showtitle' => '@',
          'idprefix' => '',
          'idseparator' => '-',
          'env' => 'github',
          'env-github' => '',
          'source-highlighter' => 'html-pipeline',
          'allow-uri-read' => true,
        }

        if filename
          attributes['docname']       = File.basename(filename, (extname = File.extname(filename)))
          attributes['docfilesuffix'] = attributes['outfilesuffix'] = extname
        else
          attributes['outfilesuffix'] = '.asciidoc'
        end

        Asciidoctor::Compliance.unique_id_start_index = 1
        Asciidoctor.convert(content, :safe => :unsafe, :base_dir => base_dir, :attributes => attributes)
      end
    end
  end
end

In anycase, I'm on 5.1 now. Thanks for all the effort on it!

All,

The company I work for has an enterprise account with GitHub and we use Gollum. By this, I opened a support ticket asking GitHub to release the markup repository and release the fix that is literally sitting at HEAD.

For two months GitHub could not locate someone to own or release the repository and support is now closing my ticket.

I think this is very solid evidence that the repository is abandoned and it should be forked or recreated. I did what I could, but it wasn't enough.

@basking2 thanks for your report, and for trying to get GitHub to move on this. I agree with your assessment of the situation: my support tickets have also been closed with barely a response. When it comes to the immediate need to solve this bug, we could of course just fork github-markup and release that. But the project currently has about a 100 open issues (many of them minor, fortunately) and about 20 open pull requests. Although the risk of security issues is small IMO (since the markup gem doesn't depend on specific versions of the rendering gems it utilizes -- so they won't run out of date), it would be nice not to depend on an unmaintained project. But @bartkamphorst and I don't have time to maintain a fork for a project of that size. Not sure how best to proceed.

Good news: github-markup has finally been updated and a new gem version has been released. I can confirm that this release fixes asciidoc support on gollum. Rejoice!

Was this page helpful?
0 / 5 - 0 ratings