# frozen_string_literal: true module Cosensee class TailwindRenderer # connect parsed lines to a code block class CodeblockBuilder include HtmlEncodable def initialize(parsed_line) @first_line = parsed_line @base_indent_level = parsed_line.indent_level @lines = [] end attr_reader :first_line, :lines, :base_indent_level def append(parsed_line) @lines << parsed_line end def continued_line?(parsed_line) parsed_line.indent_level >= base_indent_level end def render indent_level = base_indent_level * 2 title = first_line.line_content.content <<~HTML_BLOCK
#{escape_html(lines.map(&:raw).join("\n"))}