Skip to content

Commit 05ba62d

Browse files
authored
feat(lists): added input rule for ordered lists with parenthesis (#461)
1 parent 844667d commit 05ba62d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/extensions/markdown/Lists/inputrules.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ export const ListsInputRulesExtension: ExtensionWithOptions<ListsInputRulesOptio
2626

2727
/**
2828
* Given a list node type, returns an input rule that turns a number
29-
* followed by a dot at the start of a textblock into an ordered list.
29+
* followed by a dot or parenthesis at the start of a textblock into an ordered list.
3030
*/
3131
export function orderedListRule(nodeType: NodeType) {
3232
return wrappingInputRule(
33-
/^(\d+)\.\s$/,
33+
/^(\d+)([.)])\s$/,
3434
nodeType,
35-
(match) => ({[ListsAttr.Order]: Number(match[1])}),
35+
(match) => ({
36+
[ListsAttr.Order]: Number(match[1]),
37+
[ListsAttr.Markup]: match[2],
38+
}),
3639
(match, node) => node.childCount + node.attrs[ListsAttr.Order] === Number(match[1]),
3740
);
3841
}

0 commit comments

Comments
 (0)