Class AlertsExtension

java.lang.Object
org.commonmark.ext.gfm.alerts.AlertsExtension
All Implemented Interfaces:
Extension, Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, MarkdownRenderer.MarkdownRendererExtension, TextContentRenderer.TextContentRendererExtension

Extension for GFM alerts using [!TYPE] syntax (GitHub Flavored Markdown).

Create with create() or builder() and configure on builders (Parser.Builder.extensions(Iterable), HtmlRenderer.Builder.extensions(Iterable)). Parsed alerts become Alert blocks. If custom alert titles are allowed via AlertsExtension.Builder.allowCustomTitles(boolean), the inline formatting of those titles will be parsed into AlertTitle nodes.

The default configuration of this extension will match GFM exactly, with the following exceptions:

- Alert markers take precedence over shortcut reference links. - Alerts with no content are allowed. Example:


 <!-- Valid -->
 > [!NOTE]

 <!-- Also valid if custom titles are allowed -->
 > [!NOTE] Custom title

 
- Lazy continuation is not allowed between the marker and the body text. Example:

 > [!NOTE]
 Lazy body text will be parsed as a new paragraph