mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-10 06:27:59 -05:00
GP-0: Styling HTML headings in converted Markdown files
This commit is contained in:
@@ -57,6 +57,7 @@ public class MarkdownToHtml {
|
||||
HtmlRenderer renderer = HtmlRenderer.builder()
|
||||
.extensions(extensions)
|
||||
.attributeProviderFactory(new TableAttributeProvider())
|
||||
.attributeProviderFactory(new HeadingAttributeProvider())
|
||||
.attributeProviderFactory(new CodeAttributeProvider())
|
||||
.attributeProviderFactory(new LinkAttributeProvider())
|
||||
.build();
|
||||
@@ -94,6 +95,25 @@ public class MarkdownToHtml {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to add custom style to headings
|
||||
*/
|
||||
private static class HeadingAttributeProvider
|
||||
implements AttributeProvider, AttributeProviderFactory {
|
||||
@Override
|
||||
public AttributeProvider create(AttributeProviderContext attributeProviderContext) {
|
||||
return new HeadingAttributeProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributes(Node node, String tagName, Map<String, String> attributes) {
|
||||
if (node instanceof Heading heading && heading.getLevel() <= 2) {
|
||||
attributes.put("style",
|
||||
"border-bottom: solid 1px; border-bottom-color: #cccccc; padding-bottom: 8px;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to add custom style to code tags and code blocks
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user