-
Notifications
You must be signed in to change notification settings - Fork 275
Definition List Extension
flexmark-java extension for definition list processing
Definition list is one or more definition terms with one or more definitions.
Converts definition syntax of Php Markdown Extra Definition List to <dl></dl>
HTML and
corresponding AST nodes.
Definition items can be preceded by :
or ~
, depending on the configured options.
Definition Term
: Definition of above term
: Another definition of above term
Definitions terms can have no definitions if they are not the last term before a definition:
Definition Term without definition
Definition Term
: Definition of above term
: Another definition of above term
A blank line between the definition term and definition, or the definition term and previous
definition term will create a "loose" definition by wrapping its text in <p></p>
.
Definition Term
: Loose Definition of above term
: Tight definition of above term
: Another loose definition term
Will create:
<dl>
<dt>Definition Term</dt>
<dd><p>Loose Definition of above term</p></dd>
<dd>Tight definition of above term</dd>
<dd><p>Another loose definition term</p></dd>
</dl>
Lazy continuation of definitions is supported and definition terms which follow a definition must be separated from it by a blank line.
Definition Term
: Definition for Definition Term
Another Definition Term
: Definition for Another Definition Term
Inline markdown is allowed in both terms and definitions. Definitions can contain any other markdown elements provided these are indented as per list indentation rules.
Multiple definition terms cannot be separated by blank lines since all but the last term will be treated as paragraph text:
Not a definition term.
Neither is this.
Definition Term
Another Definition Term
: Definition
Inline markdown is allowed in both terms and definitions. Definitions can contain any other markdown elements provided these are indented as per list indentation rules.
Paragraph block lines are split into definition terms before inline processing it is possible that an inline markup starts on one line and finishes on another. If this paragraph is converted to definition terms then the markup will be ignored and its opening marker attributed to one definition term and its closing marker to the following one.
This is an example of split markdown inlines across definition terms:
Definition **Term
Another** Definition Term
: definition `item`
Will result in the following HTML:
<dl>
<dt>Definition **Term</dt>
<dt>Another** Definition Term</dt>
<dd>definition <code>item</code></dd>
</dl>
Use class DefinitionExtension
from artifact flexmark-ext-definition
.
The following options are available:
Defined in DefinitionExtension
class:
Static Field | Default Value | Description |
---|---|---|
COLON_MARKER | true |
enable use of : as definition item marker |
MARKER_SPACES | 1 |
minimum number of spaces after definition item marker for valid definition item |
TILDE_MARKER | true |
enable use of ~ as definition item marker |
ℹ️ this extension uses list parsing and indentation rules and will its best to align list item and definition item parsing according to selected options.