Class: Coradoc::Markdown::Serializer::Serializers::ExampleBlock

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

Overview

Example blocks emit an HTML fallback that preserves the caption as a heading inside ‘<div class=“example”>`.

When ‘admonition_style == :container` (VitePress), emits `:::details Captionn… n:::` instead.

Instance Method Summary collapse

Methods inherited from ElementSerializer

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

Instance Method Details

#call(element, ctx) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/coradoc/markdown/serializer/serializers/example_block.rb', line 17

def call(element, ctx)
  if ctx.config.admonition_style == :container
    render_container(element)
  else
    render_html(element)
  end
end