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 java.lang.Object implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, MarkdownRenderer.MarkdownRendererExtension
Extension for footnotes with syntax like GitHub Flavored Markdown:
TheSome text with a footnote[^1]. [^1]: The text of the footnote.
[^1]
is aFootnoteReference
, with "1" being the label.The line with
[^1]: ...
is aFootnoteDefinition
, 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 setFootnotesExtension.Builder.inlineFootnotes
.- See Also:
- GitHub docs for footnotes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FootnotesExtension.Builder
-
Field Summary
Fields Modifier and Type Field Description private boolean
inlineFootnotes
-
Constructor Summary
Constructors Modifier Constructor Description private
FootnotesExtension(boolean inlineFootnotes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FootnotesExtension.Builder
builder()
static Extension
create()
The extension with the default configuration (no support for inline footnotes).void
extend(Parser.Builder parserBuilder)
void
extend(HtmlRenderer.Builder rendererBuilder)
void
extend(MarkdownRenderer.Builder rendererBuilder)
Extend Markdown rendering, usually by registering custom node renderers usingMarkdownRenderer.Builder.nodeRendererFactory(org.commonmark.renderer.markdown.MarkdownNodeRendererFactory)
.
-
-
-
Method Detail
-
create
public static Extension create()
The extension with the default configuration (no support for inline footnotes).
-
builder
public static FootnotesExtension.Builder builder()
-
extend
public void extend(Parser.Builder parserBuilder)
- Specified by:
extend
in interfaceParser.ParserExtension
-
extend
public void extend(HtmlRenderer.Builder rendererBuilder)
- Specified by:
extend
in interfaceHtmlRenderer.HtmlRendererExtension
-
extend
public void extend(MarkdownRenderer.Builder rendererBuilder)
Description copied from interface:MarkdownRenderer.MarkdownRendererExtension
Extend Markdown rendering, usually by registering custom node renderers usingMarkdownRenderer.Builder.nodeRendererFactory(org.commonmark.renderer.markdown.MarkdownNodeRendererFactory)
.- Specified by:
extend
in interfaceMarkdownRenderer.MarkdownRendererExtension
- Parameters:
rendererBuilder
- the renderer builder to extend
-
-