use of com.vladsch.flexmark.ast.BulletListItem in project flexmark-java by vsch.
the class TaskListItemBlockPreProcessor method preProcess.
@Override
public void preProcess(ParserState state, Block block) {
if (block instanceof BulletListItem || block instanceof OrderedListItem) {
// we chop up the previous paragraph into definition terms and add the definition item to the last one
// we add all these to the previous DefinitionList or add a new one if there isn't one
final ListItem listItem = (ListItem) block;
final BasedSequence markerSuffix = listItem.getMarkerSuffix();
if (markerSuffix.matches("[ ]") || markerSuffix.matches("[x]") || markerSuffix.matches("[X]")) {
TaskListItem taskListItem = new TaskListItem(listItem);
taskListItem.setTight(listItem.isTight());
listItem.insertBefore(taskListItem);
listItem.unlink();
state.blockAdded(taskListItem);
state.blockRemoved(listItem);
}
}
}
Aggregations