Class: Coradoc::Markdown::DefinitionList
- Defined in:
- lib/coradoc/markdown/model/definition_list.rb
Overview
DefinitionList model representing a Kramdown definition list.
Definition lists consist of terms followed by one or more definitions. The syntax uses ‘:` to start a definition.
Syntax:
term
: definition content
multiple terms
: first definition
: second definition
Instance Method Summary collapse
-
#to_md ⇒ Object
Serialize to Markdown.
Methods inherited from Base
#serialize_content, #to_h, visit, #visit
Instance Method Details
#to_md ⇒ Object
Serialize to Markdown
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/coradoc/markdown/model/definition_list.rb', line 35 def to_md items.map do |term| term_text = term.text.to_s defs = term.definitions.map do |defn| content = defn.content.to_s ": #{content}" end.join("\n") "#{term_text}\n#{defs}" end.join("\n\n") end |