class Kramdown::Element


is valid.
The option :type can be set to an array of strings to define for which converters the raw string
element is used. If it is set to :span, then no blank lines are allowed in the raw text.
The option :category has to be set to either :span or :block depending on the context where the
The value field has to contain the actual raw text.
HTML code that should be output as-is without modification and escaping.
Represents a raw string that should not be modified. For example, the element could contain some
[Content model] None
[Usage context] Where block/span-level elements are expected<br> Block/span-level element
=== :raw
element is used. If it is set to :span, then no blank lines are allowed in the comment.
The option :category has to be set to either :span or :block depending on the context where the
The value field has to contain the comment.
Represents a comment.
[Content model] None
[Usage context] Where block/span-level elements are expected<br> Block/span-level element
=== :comment
element is used.
The option :category has to be set to either :span or :block depending on the context where the
delimiters.
The value field has to contain the whole XML/HTML processing instruction including the
Represents an XML/HTML processing instruction.
[Content model] None
[Usage context] Where block/span-level elements are expected or in raw HTML elements<br> Block/span-level element
=== :xml_pi
element is used.
The option :category has to be set to either :span or :block depending on the context where the
The value field has to contain the whole XML/HTML comment including the delimiters.
Represents an XML/HTML comment.
[Content model] None
[Usage context] Where block/span-level elements are expected or in raw HTML elements<br> Block/span-level element
=== :xml_comment
contains span-level elements or :raw if it contains raw content).
content model for the element (either :block if it contains block-level elements, :span if it
element is a block-level or a span-level element. The option :content_model has to be set to the
The option :category has to be set to either :span or :block depending on the whether the
The value field has to contain the name of the HTML element the element is representing.
Represents an HTML element.
[Content model] Depends on the element
[Usage context] Where block/span-level elements or raw HTML elements are expected<br> Block/span-level element
=== :html_element
== Other Elements
abbreviation is stored in the :root element of the document.
The value field has to contain the text part that is the abbreviation. The definition of the
Represents a text part that is an abbreviation.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :abbreviation
:rdquo
Right double quote
:ldquo
Left double quote
:rsquo
Right single quote
:lsquo
Left single quote
The value field needs to contain a Symbol representing the specific quotation character:
Represents a quotation character.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :smart_quote
:raquo_space
A right guillemet with a space ( >>)
:laquo_space
A left guillemet with a space (<< )
:raquo
A right guillemet (>>)
:laquo
A left guillemet (<<)
:hellip
An ellipsis (…)
:ndash
An ndash character (–)
:mdash
An mdash character (—)
the following list:
The value field needs to contain a Symbol representing the specific typographic symbol from
Represents a typographic symbol.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :typographic_sym
:original can be used to store the original representation of the entity.
The value field has to contain an instance of Kramdown::Utils::Entities::Entity. The option
Represents an HTML entity.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :entity
Represents strong importance for its contents.
[Content model] Span-level elements
[Usage context] Where span-level elements are expected<br> Span-level element
=== :strong
Represents emphasis of its contents.
[Content model] Span-level elements
[Usage context] Where span-level elements are expected<br> Span-level element
=== :em
dashes.
a word character or a digit and then optionally followed by other word characters, digits or
option :name has to contain a valid and unique footnote name. A valid footnote name consists of
The value field has to contain an element whose children are the content of the footnote. The
Represents a footnote marker.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :footnote
The value field has to contain the content of the code span.
Represents verbatim text.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :codespan
text description of the image. The attribute title optionally contains the title of the image.
The attribute src has to be set to the URL of the image. The attribute alt has to contain a
Represents an image.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :img
optionally contains the title of the link.
The attribute href has to be set to the URL to which the link points. The attribute title
Represents a link to an URL.
[Content model] Span-level elements
[Usage context] Where span-level elements are expected<br> Span-level element
=== :a
Represents a hard line break.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :br
The value field has to contain the text itself.
Represents text.
[Content model] None
[Usage context] Where span-level elements are expected<br> Span-level element
=== :text
== Text Markup Elements
element is used.
The option :category has to be set to either :span or :block depending on the context where the
The value field has to contain the actual mathematical text.
Represents mathematical text that is written in LaTeX.
[Content model] None
[Usage context] Where block/span-level elements are expected<br> Block/span-level element
=== :math
Represents a table cell.
:tfoot/:tr block-level elements
[Content model] As child of :thead/:tr span-level elements, as child of :tbody/:tr and
[Usage context] Inside :tr elements<br> Block-level element
=== :td
Represents a table row.
[Content model] One or more :td elements
[Usage context] Inside :thead, :tbody and :tfoot elements<br> None
=== :tr
Represents the table footer.
[Content model] One or more :tr elements
[Usage context] As last element inside a :table element<br> None
=== :tfoot
Represents a table body.
[Content model] One or more :tr elements
[Usage context] After a :thead element but before a :tfoot element inside a :table element<br> None
=== :tbody
Represents the table header.
[Content model] One or more :tr elements
[Usage context] As first element inside a :table element<br> None
=== :thead
column of the table. The possible alignment values are :left, :center, :right and :default.
The option :alignment has to be an array containing the alignment values, exactly one for each
number of :td elements.
Represents a table. Each table row (i.e. :tr element) of the table has to contain the same
elements
[Content model] Zero or one :thead elements, one or more :tbody elements, zero or one :tfoot
[Usage context] Where block-level elements are expected<br> Block-level element
=== :table
Represents a horizontal line.
[Content model] None
[Usage context] Where block-level elements are expected<br> Block-level element
=== :hr
Represents the definition part of a term-definition group in a definition list.
[Content model] Block-level elements
[Usage context] After :dt or :dd elements inside a :dl elment<br> Block-level element
=== :dd
Represents the term part of a term-definition group in a definition list.
[Content model] Span-level elements
[Usage context] Before :dt or :dd elements inside a :dl elment<br> Block-level element
=== :dt
Represents a definition list which contains groups consisting of terms and definitions for them.
or more :dd elements.
[Content model] One or more groups each consisting of one or more :dt elements followed by one
[Usage context] Where block-level elements are expected<br> Block-level element
=== :dl
Note that the first child of a list item must not be a :blank element!
Represents a list item of an ordered or unordered list.
[Content model] Block-level elements
[Usage context] Inside :ol and :ul elements<br> Block-level element
=== :li
Represents an ordered list.
[Content model] One or more :li elements
[Usage context] Where block-level elements are expected<br> Block-level element
=== :ol
Represents an unordered list.
[Content model] One or more :li elements
[Usage context] Where block-level elements are expected<br> Block-level element
=== :ul
a class name of the form ‘language-LANG’.
php?start_inline=1) and should be used instead of a possibly also available language embedded in
The option :lang specifies a highlighting language with possible HTML style options (e.g.
The value field has to contain the content of the code block.
Represents a code block, i.e. a block of text that should be used as-is.
[Content model] Empty
[Usage context] Where block-level elements are expected<br> Block-level element
=== :codeblock
Represents a blockquote.
[Content model] Block-level elements
[Usage context] Where block-level elements are expected<br> Block-level element
=== :blockquote
option :raw_text has to contain the raw header text.
The option :level specifies the header level and has to contain a number between 1 and 6. The
Represents a header.
[Content model] Span-level elements
[Usage context] Where block-level elements are expected<br> Block-level element
=== :header
element just functions as a container for span-level elements.
If the option :transparent is true, this element just represents a block of text. I.e. this
Represents a paragraph.
[Content model] Span-level elements
[Usage context] Where block-level elements are expected<br> Block-level element
=== :p
The value field may contain the original content of the blank lines.
elements.
Represents one or more blank lines. It is not allowed to have two or more consecutive blank
[Content model] Empty
[Usage context] Where block-level elements are expected<br> Block-level element
=== :blank
:footnote_count
This key stores the number of actually referenced footnotes of the document.
:options
This key may be used to store options that were set during parsing of the document.
attributes.
:abbrev_attr
This key may be used to store the mapping of abbreviation to abbreviation
definition.
:abbrev_defs
This key may be used to store the mapping of abbreviation to abbreviation
parts of the kramdown document.
:encoding

When running on Ruby 1.9 this key has to be set to the encoding used for the text
The root element contains the following option keys:
Represents the root of a kramdown document.
[Content model] Block-level elements
[Usage context] As the root element of a document<br> None
=== :root
== Structural Elements
document.
Note that the option :location may contain the start line number of an element in the source
Following is a description of all supported element types.
new_root.children = [root.children] # assign new array with elements to convert
new_root = root.dup
root = doc.root
converted, duplicate the root node and assign the #children appropriately, e.g:
option keys set so that conversions work correctly. If only a part of a tree should be
The root of a kramdown element tree has to be an element of type :root. It needs to have certain
(paragraphs, headers, emphasis, …). The type of element can be set via the #type accessor.
kramdown only uses this one class for representing all available elements in an element tree
Represents all elements in the element tree.

def self.category(el)

or a span-level context. These elements need to have the option :category correctly set.
Most elements have a fixed category, however, some elements can either appear in a block-level

Return the category of +el+ which can be :block, :span or +nil+.
def self.category(el)
  CATEGORY[el.type] || el.options[:category]
end

def attr

The attributes of the element.
def attr
  @attr ||= {}
end

def block?

Returns boolean true or false.

+el.block?+.
syntactic sugar to simplify calls such as +Kramdown::Element.category(el) == :block+ with
def block?
  (CATEGORY[type] || options[:category]) == :block
end

def initialize(type, value = nil, attr = nil, options = nil)

+options+ can also be set in this constructor for convenience.
Create a new Element object of type +type+. The optional parameters +value+, +attr+ and
def initialize(type, value = nil, attr = nil, options = nil)
  @type, @value, @attr, @options = type, value, attr, options
  @children = []
end

def inspect # :nodoc:

:nodoc:
def inspect # :nodoc:
  "<kd:#{@type}" \
    "#{value.nil? ? '' : ' value=' + value.inspect}" \
    "#{attr.empty? ? '' : ' attr=' + attr.inspect}" \
    "#{options.empty? ? '' : ' options=' + options.inspect}" \
    "#{children.empty? ? '' : ' children=' + children.inspect}>"
end

def options

The options hash for the element. It is used for storing arbitray options.
def options
  @options ||= {}
end

def span?

Returns boolean true or false.

+el.span?+.
syntactic sugar to simplify calls such as +Kramdown::Element.category(el) == :span+ with
def span?
  (CATEGORY[type] || options[:category]) == :span
end