- class Renderer < Redcarpet::Render::XHTML
- def link(link, _title, alt_text)
- "<a rel=\"nofollow\" href=\"#{link}\">#{alt_text}</a>"
+ def description
+ return @description if defined? @description
+
+ @description = first_truncated_text_content(document.root)
+ end
+
+ private
+
+ def document
+ @document ||= Kramdown::Document.new(self)
+ end
+
+ def first_image_element(element)
+ return element if image?(element) && element.attr["src"].present?
+
+ element.children.find do |child|
+ nested_image = first_image_element(child)
+ break nested_image if nested_image