rouge-ruby/rouge · error · RuntimeError

unknown token: #{tok.inspect}

Error message

unknown token: #{tok.inspect}

What it means

Error "unknown token: #{tok.inspect}" thrown in rouge-ruby/rouge.

Source

Thrown at lib/rouge/theme.rb:191

      yield "#{@scope} table pre { margin: 0; }"

      styles.each do |tok, style|
        Style.new(self, style).render(css_selector(tok), &b)
      end
    end

    def render_base(selector, &b)
      self.class.base_style.render(selector, &b)
    end

    def style_for(tok)
      self.class.get_style(tok)
    end

  private
    def css_selector(token)
      inflate_token(token).map do |tok|
        raise "unknown token: #{tok.inspect}" if tok.shortname.nil?

        single_css_selector(tok)
      end.join(', ')
    end

    def single_css_selector(token)
      return @scope if token == Text

      "#{@scope} .#{token.shortname}"
    end

    # yield all of the tokens that should be styled the same
    # as the given token.  Essentially this recursively all of
    # the subtokens, except those which are more specifically
    # styled.
    def inflate_token(tok, &b)
      return enum_for(:inflate_token, tok) unless block_given?

View on GitHub (pinned to bd7dad7b09)

When it happens

Trigger: Thrown at lib/rouge/theme.rb:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rouge-ruby/rouge@bd7dad7b09 (2026-08-23). Data as JSON: /api/errors/5d65500efb122cbd. Report an issue: GitHub.