taking into account the html start position when creating html ordered lists

This commit is contained in:
Adam Brown 2022-07-05 20:55:28 +01:00
parent c8ceb6c467
commit f442121826

View File

@ -19,6 +19,8 @@ import io.noties.markwon.html.TagHandler;
public class ListHandler extends TagHandler { public class ListHandler extends TagHandler {
private static final String START_KEY = "start";
@Override @Override
public void handle( public void handle(
@NonNull MarkwonVisitor visitor, @NonNull MarkwonVisitor visitor,
@ -41,7 +43,7 @@ public class ListHandler extends TagHandler {
final RenderProps renderProps = visitor.renderProps(); final RenderProps renderProps = visitor.renderProps();
final SpanFactory spanFactory = configuration.spansFactory().get(ListItem.class); final SpanFactory spanFactory = configuration.spansFactory().get(ListItem.class);
int number = 1; int number = Integer.parseInt(block.attributes().containsKey(START_KEY) ? block.attributes().get(START_KEY) : "1");
final int bulletLevel = currentBulletListLevel(block); final int bulletLevel = currentBulletListLevel(block);
for (HtmlTag.Block child : block.children()) { for (HtmlTag.Block child : block.children()) {