Class: Coradoc::Markdown::Admonition
- Defined in:
- lib/coradoc/markdown/model/admonition.rb
Overview
Admonition block — a callout like NOTE, WARNING, TIP, etc.
Markdown has no native admonition syntax (GFM Alerts since Dec 2023 notwithstanding — see admonition/gfm_alert strategy). The ‘admonition_style` config option selects the output form:
:github → > **NOTE:** text (broad compat)
:gfm_alert → > [!NOTE]\n> text (GFM native since 2024)
:container → :::note\n... \n::: (VitePress / markdown-it)
:html → <div class="note">...</div>
Type is stored lowercase. Content is raw Markdown text (already serialized). Title is optional.
Constant Summary collapse
- ALLOWED_TYPES =
%w[note tip warning important caution].freeze
Instance Method Summary collapse
-
#initialize(admonition_type:, content:, title: nil, **rest) ⇒ Admonition
constructor
A new instance of Admonition.
Methods inherited from Base
Constructor Details
#initialize(admonition_type:, content:, title: nil, **rest) ⇒ Admonition
Returns a new instance of Admonition.
27 28 29 30 31 32 |
# File 'lib/coradoc/markdown/model/admonition.rb', line 27 def initialize(admonition_type:, content:, title: nil, **rest) super @admonition_type = admonition_type.to_s.downcase @content = content @title = title end |