From 13f3a70334e0d8f32589d5cb9e3929fe3518da90 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Wed, 30 Oct 2024 06:50:36 -0400 Subject: [PATCH] GP-0: Adding support for footnotes --- GhidraBuild/MarkdownSupport/build.gradle | 1 + .../src/main/java/ghidra/markdown/MarkdownToHtml.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/GhidraBuild/MarkdownSupport/build.gradle b/GhidraBuild/MarkdownSupport/build.gradle index 6ca736dcce..68b3f5d096 100644 --- a/GhidraBuild/MarkdownSupport/build.gradle +++ b/GhidraBuild/MarkdownSupport/build.gradle @@ -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' } diff --git a/GhidraBuild/MarkdownSupport/src/main/java/ghidra/markdown/MarkdownToHtml.java b/GhidraBuild/MarkdownSupport/src/main/java/ghidra/markdown/MarkdownToHtml.java index 47cbfdacf8..d0b900d5e9 100644 --- a/GhidraBuild/MarkdownSupport/src/main/java/ghidra/markdown/MarkdownToHtml.java +++ b/GhidraBuild/MarkdownSupport/src/main/java/ghidra/markdown/MarkdownToHtml.java @@ -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 extensions = List.of(HeadingAnchorExtension.create()); + // Setup the CommonMark Library with the needed extension libraries + List extensions = + List.of(HeadingAnchorExtension.create(), FootnotesExtension.create()); Parser parser = Parser.builder().extensions(extensions).build(); HtmlRenderer renderer = HtmlRenderer.builder() .extensions(extensions)