GP-5496: Converting headless readme to markdown

This commit is contained in:
Ryan Kurtz 2025-02-28 16:33:35 -05:00
parent 6d44b9bad7
commit 95060a2dd8
6 changed files with 1084 additions and 1448 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,18 @@ rootProject.assembleDistribution {
}
}
rootProject.assembleMarkdownToHtml {
from (this.project.file("Common/support")) {
include "*.md"
into "support"
}
from (this.project.file("Common/server")) {
include "*.md"
into "server"
}
}
rootProject.PLATFORMS.each { platform ->
rootProject.tasks.findAll {it.name == "assembleDistribution_${platform.name}"}.each { t ->
def p = this.project

View file

@ -6,7 +6,7 @@ Common/server/jaas.conf||GHIDRA||||END|
Common/server/server.conf||GHIDRA||||END|
Common/server/svrREADME.html||GHIDRA||||END|
Common/support/GhidraGo/ghidraGoREADME.html||GHIDRA||||END|
Common/support/analyzeHeadlessREADME.html||GHIDRA||||END|
Common/support/analyzeHeadlessREADME.md||GHIDRA||||END|
Common/support/buildGhidraJarREADME.txt||GHIDRA||||END|
Common/support/debug.log4j.xml||GHIDRA||||END|
Common/support/gradle/gradle-wrapper.jar||Apache License 2.0||||END|

View file

@ -21,4 +21,5 @@ 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'
implementation 'org.commonmark:commonmark-ext-gfm-tables:0.23.0'
}

View file

@ -21,6 +21,7 @@ import java.util.Map;
import org.commonmark.Extension;
import org.commonmark.ext.footnotes.FootnotesExtension;
import org.commonmark.ext.gfm.tables.*;
import org.commonmark.ext.heading.anchor.HeadingAnchorExtension;
import org.commonmark.node.Link;
import org.commonmark.node.Node;
@ -51,11 +52,12 @@ public class MarkdownToHtml {
}
// Setup the CommonMark Library with the needed extension libraries
List<Extension> extensions =
List.of(HeadingAnchorExtension.create(), FootnotesExtension.create());
List<Extension> extensions = List.of(HeadingAnchorExtension.create(),
FootnotesExtension.create(), TablesExtension.create());
Parser parser = Parser.builder().extensions(extensions).build();
HtmlRenderer renderer = HtmlRenderer.builder()
.extensions(extensions)
.attributeProviderFactory(new TableAttributeProvider())
.attributeProviderFactory(new LinkAttributeProvider())
.build();
@ -73,6 +75,25 @@ public class MarkdownToHtml {
}
}
/**
* Class to add custom style to tables
*/
private static class TableAttributeProvider
implements AttributeProvider, AttributeProviderFactory {
@Override
public AttributeProvider create(AttributeProviderContext attributeProviderContext) {
return new TableAttributeProvider();
}
@Override
public void setAttributes(Node node, String tagName, Map<String, String> attributes) {
if (node instanceof TableBlock || node instanceof TableCell) {
attributes.put("style",
"border: 1px solid black; border-collapse: collapse; padding: 5px;");
}
}
}
/**
* Class to help adjust links to Markdown files to instead become links to HTML files
*/