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
-
#admonition_type=(value) ⇒ Object
Normalize type on assignment.
Methods inherited from Base
Instance Method Details
#admonition_type=(value) ⇒ Object
Normalize type on assignment. Callers can pass "NOTE", "Note", or "note" — storage is always lowercase so downstream comparison and CSS class generation don't need to repeat the normalization.
35 36 37 |
# File 'lib/coradoc/markdown/model/admonition.rb', line 35 def admonition_type=(value) super(value.to_s.downcase) end |