Package org.commonmark.ext.footnotes
Class FootnotesExtension
java.lang.Object
org.commonmark.ext.footnotes.FootnotesExtension
- All Implemented Interfaces:
Extension,Parser.ParserExtension,HtmlRenderer.HtmlRendererExtension,MarkdownRenderer.MarkdownRendererExtension
public class FootnotesExtension
extends Object
implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, MarkdownRenderer.MarkdownRendererExtension
Extension for footnotes with syntax like GitHub Flavored Markdown:
Some text with a footnote[^1].
[^1]: The text of the footnote.
The [^1] is a FootnoteReference, with "1" being the label.
The line with [^1]: ... is a FootnoteDefinition, with the contents as child nodes (can be a
paragraph like in the example, or other blocks like lists).
All the footnotes (definitions) will be rendered in a list at the end of a document, no matter where they appear in the source. The footnotes will be numbered starting from 1, then 2, etc, depending on the order in which they appear in the text (and not dependent on the label). The footnote reference is a link to the footnote, and from the footnote there is a link back to the reference (or multiple).
There is also optional support for inline footnotes, use builder() and then set FootnotesExtension.Builder.inlineFootnotes.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FootnotesExtension.Builderbuilder()static Extensioncreate()The extension with the default configuration (no support for inline footnotes).voidextend(Parser.Builder parserBuilder) voidextend(HtmlRenderer.Builder rendererBuilder) voidextend(MarkdownRenderer.Builder rendererBuilder) Extend Markdown rendering, usually by registering custom node renderers usingMarkdownRenderer.Builder.nodeRendererFactory(org.commonmark.renderer.markdown.MarkdownNodeRendererFactory).
-
Field Details
-
inlineFootnotes
private final boolean inlineFootnotes
-
-
Constructor Details
-
FootnotesExtension
private FootnotesExtension(boolean inlineFootnotes)
-
-
Method Details
-
create
The extension with the default configuration (no support for inline footnotes). -
builder
-
extend
- Specified by:
extendin interfaceParser.ParserExtension
-
extend
- Specified by:
extendin interfaceHtmlRenderer.HtmlRendererExtension
-
extend
Description copied from interface:MarkdownRenderer.MarkdownRendererExtensionExtend Markdown rendering, usually by registering custom node renderers usingMarkdownRenderer.Builder.nodeRendererFactory(org.commonmark.renderer.markdown.MarkdownNodeRendererFactory).- Specified by:
extendin interfaceMarkdownRenderer.MarkdownRendererExtension- Parameters:
rendererBuilder- the renderer builder to extend
-