Class | Kramdown::Element |
In: |
lib/kramdown/document.rb
|
Parent: | Object |
Represents all elements in the element tree.
kramdown only uses this one class for representing all available elements in an element tree (paragraphs, headers, emphasis, …). The type of element can be set via the type accessor.
Following is a description of all supported element types.
Represents the root of a kramdown document.
The root element contains the following option keys:
:encoding: | When running on Ruby 1.9 this key has to be set to the encoding used for the text parts of the kramdown document. |
:abbrev_defs: | This key may be used to store the mapping of abbreviation to abbreviation definition. |
Represents one or more blank lines. It is not allowed to have two or more consecutive blank elements.
The value field may contain the original content of the blank lines.
Represents a paragraph.
If the option :transparent is true, this element just represents a block of text. I.e. this element just functions as a container for span-level elements.
Represents a header.
The option :level specifies the header level and has to contain a number between 1 and \6. The option :raw_text has to contain the raw header text.
Represents a blockquote.
Represents a code block, i.e. a block of text that should be used as-is.
The value field has to contain the content of the code block.
Represents an unordered list.
Represents an ordered list.
Represents a list item of an ordered or unordered list.
Represents a definition list which contains groups consisting of terms and definitions for them.
Represents the term part of a term-definition group in a definition list.
Represents the definition part of a term-definition group in a definition list.
Represents a horizontal line.
Represents a table. Each table row (i.e. :tr element) of the table has to contain the same number of :td elements.
The option :alignment has to be an array containing the alignment values, exactly one for each column of the table. The possible alignment values are :left, :center, :right and :default.
Represents the table header.
Represents a table body.
Represents the table footer.
Represents a table row.
Represents a table cell.
Represents mathematical text that is written in LaTeX.
The value field has to contain the actual mathematical text.
The option :category has to be set to either :span or :block depending on the context where the element is used.
Represents text.
The value field has to contain the text itself.
Represents a hard line break.
Represents a link to an URL.
The attribute href has to be set to the URL to which the link points. The attribute title optionally contains the title of the link.
Represents an image.
The attribute src has to be set to the URL of the image. The attribute alt has to contain a text description of the image. The attribute title optionally contains the title of the image.
Represents verbatim text.
The value field has to contain the content of the code span.
Represents a footnote marker.
The value field has to contain an element whose children are the content of the footnote. The option :name has to contain a valid and unique footnote name. A valid footnote name consists of a word character or a digit and then optionally followed by other word characters, digits or dashes.
Represents emphasis of its contents.
Represents strong importance for its contents.
Represents an HTML entity.
The value field has to contain an instance of Kramdown::Utils::Entities::Entity. The option :original can be used to store the original representation of the entity.
Represents a typographic symbol.
The value field needs to contain a Symbol representing the specific typographic symbol from the following list:
:mdash: | An mdash character (—) |
:ndash: | An ndash character (—) |
:hellip: | An ellipsis (…) |
:laquo: | A left guillemet (<<) |
:raquo: | A right guillemet (>>) |
:laquo_space: | A left guillemet with a space (<< ) |
:raquo_space: | A right guillemet with a space ( >>) |
Represents a quotation character.
The value field needs to contain a Symbol representing the specific quotation character:
:lsquo: | Left single quote |
:rsquo: | Right single quote |
:ldquo: | Left double quote |
:rdquo: | Right double quote |
Represents a text part that is an abbreviation.
The value field has to contain the text part that is the abbreviation. The definition of the abbreviation is stored in the :root element of the document.
Represents an HTML element.
The value field has to contain the name of the HTML element the element is representing.
The option :category has to be set to either :span or :block depending on the whether the element is a block-level or a span-level element. The option :content_model has to be set to the content model for the element (either :block if it contains block-level elements, :span if it contains span-level elements or :raw if it contains raw content).
Represents an XML/HTML comment.
The value field has to contain the whole XML/HTML comment including the delimiters.
The option :category has to be set to either :span or :block depending on the context where the element is used.
Represents an XML/HTML processing instruction.
The value field has to contain the whole XML/HTML processing instruction including the delimiters.
The option :category has to be set to either :span or :block depending on the context where the element is used.
Represents a comment.
The value field has to contain the comment.
The option :category has to be set to either :span or :block depending on the context where the element is used.
Represents a raw string that should not be modified. For example, the element could contain some HTML code that should be output as-is without modification and escaping.
The value field has to contain the actual raw text.
The option :category has to be set to either :span or :block depending on the context where the element is used. The option :type can be set to an array of strings to define for which converters the raw string is valid.
children | [RW] | The child elements of this element. |
type | [RW] | A symbol representing the element type. For example, :p or :blockquote. |
value | [RW] | The value of the element. The interpretation of this field depends on the type of the element. Many elements don‘t use this field. |