Class: Coradoc::Markdown::Serializer::Serializers::Sidebar

Inherits:
ElementSerializer show all
Defined in:
lib/coradoc/markdown/serializer/serializers/sidebar.rb

Overview

Sidebar block — a callout box. VitePress maps the ‘:::info` custom container to a styled callout, which matches AsciiDoc’s sidebar semantics without leaking raw HTML into the Markdown.

Instance Method Summary collapse

Methods inherited from ElementSerializer

call, handles?, #handles?, handles_type, #handles_type

Instance Method Details

#call(element, ctx) ⇒ Object



15
16
17
18
19
20
# File 'lib/coradoc/markdown/serializer/serializers/sidebar.rb', line 15

def call(element, ctx)
  title = element.title.to_s
  header = title.empty? ? '' : " #{title}"
  body = render_body(element, ctx)
  ":::info#{header}\n#{body}\n:::"
end