Skip to content

Number the items of ordered lists - #134

Open
samipuro wants to merge 1 commit into
mtibben:masterfrom
samipuro:feature/numbered-ordered-lists
Open

samipuro wants to merge 1 commit into
mtibben:masterfrom
samipuro:feature/numbered-ordered-lists

Conversation

@samipuro

Copy link
Copy Markdown

Fixes #120.

Items of <ol> lists are now rendered as 1. Item instead of * Item. The start attribute is respected, and nested lists keep their own type and numbering, e.g. a <ul> inside an <ol> still uses bullets.

The new convertOrderedLists() makes one linear pass over the list tags with a stack. It adds a |+|ol|+|N|+| marker after each <li> of an ordered list, which converter() turns into N. . This is the same technique already used for |+|amp|+|. Unordered lists are unchanged.

ListTest::testOrderedList is updated to the numbered output, and tests are added for start and for nested lists. If you'd rather keep bullets as the default, I can put this behind an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use numbers instead of bullets for ordered lists

1 participant