Class: Coradoc::Markdown::ExampleBlock

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/markdown/model/example_block.rb

Overview

Example block — an illustrative container, optionally with a caption.

Markdown has no native example syntax. Default rendering is an HTML fallback that preserves the caption as an <h4> heading inside a <div class="example"> wrapper.

When admonition_style == :container (VitePress), the serializer emits :::details Caption\n...\n:::.

Instance Method Summary collapse

Methods inherited from Base

visit, #visit

Constructor Details

#initialize(content:, caption: nil, children: [], **rest) ⇒ ExampleBlock

Returns a new instance of ExampleBlock.



20
21
22
23
24
25
# File 'lib/coradoc/markdown/model/example_block.rb', line 20

def initialize(content:, caption: nil, children: [], **rest)
  super
  @content = content
  @caption = caption
  @children = Array(children)
end