{"record":{"id":"141d6cd136aa55d9","repo":"rouge-ruby/rouge","slug":"expected-an-instance-of-rouge-formatters-html-g","errorCode":null,"errorMessage":"Expected an instance of Rouge::Formatters::HTML, got #{formatter.class}. Try HTML, HTMLDebug, or HTMLInline.","messagePattern":"Expected an instance of Rouge::Formatters::HTML, got #(.+?)\\. Try HTML, HTMLDebug, or HTMLInline\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/rouge/formatters/html.rb","lineNumber":20,"sourceCode":"# frozen_string_literal: true\n\nmodule Rouge\n  module Formatters\n    # Transforms a token stream into HTML output.\n    class HTML < Formatter\n      TABLE_FOR_ESCAPE_HTML = {\n        '&' => '&amp;',\n        '<' => '&lt;',\n        '>' => '&gt;',\n        \"\\r\" => \"\",\n      }.freeze\n\n      ESCAPE_REGEX = /[&<>\\r]/.freeze\n\n      def self.assert_html_formatter!(formatter)\n        return formatter if formatter.respond_to?(:span)\n\n        raise ArgumentError.new(\"Expected an instance of Rouge::Formatters::HTML, got #{formatter.class}. Try HTML, HTMLDebug, or HTMLInline.\")\n      end\n\n      tag 'html'\n\n      # @yield the html output.\n      def stream(tokens, &b)\n        tokens.each { |tok, val| yield span(tok, val) }\n      end\n\n      def span(tok, val)\n        return val if escape?(tok)\n\n        safe_span(tok, escape_special_html_chars(val))\n      end\n\n      def safe_span(tok, safe_val)\n        if tok == Token::Tokens::Text\n          safe_val","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/rouge-ruby/rouge/blob/bd7dad7b0939c556e582a0370686f6fc022c8af5/lib/rouge/formatters/html.rb#L2-L38","documentation":"Error \"Expected an instance of Rouge::Formatters::HTML, got #{formatter.class}. Try HTML, HTMLDebug, or HTMLInline.\" thrown in rouge-ruby/rouge.","triggerScenarios":"Thrown at lib/rouge/formatters/html.rb:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bd7dad7b0939c556e582a0370686f6fc022c8af5","analyzedAt":"2026-08-23T11:34:50.713Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}