Skip to content

Commit

Permalink
fix: 馃悰 make list item label can update when insert
Browse files Browse the repository at this point in the history
  • Loading branch information
Saul-Mirone committed Aug 6, 2022
1 parent a4c8bcd commit 40d8340
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/preset-commonmark/src/node/list-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const createKeepListOrderPlugin = (type: NodeType) => {
changed = true;
}

const prev = parent?.maybeChild(index - 1);
if (prev && prev.type === type && prev.attrs['listType'] === 'ordered') {
const label = prev.attrs['label'];
attrs['label'] = `${Number(label.slice(0, -1)) + 1}.`;
const base = parent?.maybeChild(0);
if (base && base.type === type && base.attrs['listType'] === 'ordered') {
const label = base.attrs['label'];
attrs['label'] = `${Number(label.slice(0, -1)) + index}.`;
changed = true;
}

Expand Down

0 comments on commit 40d8340

Please sign in to comment.