Class: Coradoc::Markdown::Serializer::Strategies::Admonition::Github

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/markdown/serializer/strategies/admonition/github.rb

Overview

GitHub-style: a styled blockquote with ‘TYPE:` prefix. Renders correctly in GitHub, GitLab, and most renderers that recognize the bold-prefix pattern.

Class Method Summary collapse

Methods inherited from Base

mode_name

Class Method Details

.render(admonition, _ctx) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/coradoc/markdown/serializer/strategies/admonition/github.rb', line 15

def render(admonition, _ctx)
  type = admonition.admonition_type.to_s.upcase
  body = admonition.content.to_s
  if admonition.title
    body = "**#{admonition.title}**\n\n#{body}" unless admonition.title.to_s.strip.empty?
  end
  "> **#{type}:** #{body}"
end