Class HeadingAnchorExtension
java.lang.Object
org.commonmark.ext.heading.anchor.HeadingAnchorExtension
- All Implemented Interfaces:
Extension
,HtmlRenderer.HtmlRendererExtension
Extension for adding auto generated IDs to headings.
Create it with create()
or builder()
and then configure it on the
renderer builder (HtmlRenderer.Builder.extensions(Iterable)
).
The heading text will be used to create the id. Multiple headings with the same text will result in appending a hyphen and number. For example:
# Heading
# Heading
will result in
<h1 id="heading">Heading</h1>
<h1 id="heading-1">Heading</h1>
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
static Extension
create()
void
extend
(HtmlRenderer.Builder rendererBuilder)
-
Field Details
-
defaultId
-
idPrefix
-
idSuffix
-
-
Constructor Details
-
HeadingAnchorExtension
-
-
Method Details
-
create
- Returns:
- the extension built with default settings
-
builder
- Returns:
- a builder to configure the extension settings
-
extend
- Specified by:
extend
in interfaceHtmlRenderer.HtmlRendererExtension
-