mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-0: Styling HTML headings in converted Markdown files
This commit is contained in:
parent
768788c078
commit
e8f539f622
1 changed files with 20 additions and 0 deletions
|
@ -57,6 +57,7 @@ public class MarkdownToHtml {
|
||||||
HtmlRenderer renderer = HtmlRenderer.builder()
|
HtmlRenderer renderer = HtmlRenderer.builder()
|
||||||
.extensions(extensions)
|
.extensions(extensions)
|
||||||
.attributeProviderFactory(new TableAttributeProvider())
|
.attributeProviderFactory(new TableAttributeProvider())
|
||||||
|
.attributeProviderFactory(new HeadingAttributeProvider())
|
||||||
.attributeProviderFactory(new CodeAttributeProvider())
|
.attributeProviderFactory(new CodeAttributeProvider())
|
||||||
.attributeProviderFactory(new LinkAttributeProvider())
|
.attributeProviderFactory(new LinkAttributeProvider())
|
||||||
.build();
|
.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
|
* Class to add custom style to code tags and code blocks
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue