use of com.vladsch.flexmark.ext.anchorlink.AnchorLink in project flexmark-java by vsch.
the class AnchorLinkNodePostProcessor method process.
@Override
public void process(NodeTracker state, Node node) {
if (node instanceof Heading) {
if (node.isOrDescendantOfType(BlockQuote.class)) {
int tmp = 0;
}
Heading heading = (Heading) node;
if (heading.getText().isNotNull()) {
Node anchor = new AnchorLink();
if (!options.wrapText) {
if (heading.getFirstChild() == null) {
anchor.setChars(heading.getText().subSequence(0, 0));
heading.appendChild(anchor);
} else {
anchor.setChars(heading.getFirstChild().getChars().subSequence(0, 0));
heading.getFirstChild().insertBefore(anchor);
}
} else {
anchor.takeChildren(heading);
heading.appendChild(anchor);
}
anchor.setCharsFromContent();
state.nodeAdded(anchor);
}
} else {
int tmp = 0;
}
}
Aggregations