GP-0: Adding support for footnotes

This commit is contained in:
Ryan Kurtz 2024-10-30 06:50:36 -04:00
parent 66068da147
commit 13f3a70334
2 changed files with 5 additions and 2 deletions

View File

@ -20,4 +20,5 @@ eclipse.project.name = '_MarkdownSupport'
dependencies {
implementation 'org.commonmark:commonmark:0.23.0'
implementation 'org.commonmark:commonmark-ext-heading-anchor:0.23.0'
implementation 'org.commonmark:commonmark-ext-footnotes:0.23.0'
}

View File

@ -20,6 +20,7 @@ import java.util.List;
import java.util.Map;
import org.commonmark.Extension;
import org.commonmark.ext.footnotes.FootnotesExtension;
import org.commonmark.ext.heading.anchor.HeadingAnchorExtension;
import org.commonmark.node.Link;
import org.commonmark.node.Node;
@ -49,8 +50,9 @@ public class MarkdownToHtml {
throw new Exception("First argument doesn't not end with .md");
}
// Setup the CommonMark Library with the needed "anchor extension" library
List<Extension> extensions = List.of(HeadingAnchorExtension.create());
// Setup the CommonMark Library with the needed extension libraries
List<Extension> extensions =
List.of(HeadingAnchorExtension.create(), FootnotesExtension.create());
Parser parser = Parser.builder().extensions(extensions).build();
HtmlRenderer renderer = HtmlRenderer.builder()
.extensions(extensions)