redcarpet
redcarpet copied to clipboard
Add `step` parameter to `#list_item`
Would be useful to add a step parameter to the list_item method for ordered lists. That would allow users to do the following:
def list_item text, list_type, step = nil
case list_type
when :ordered
%{<li data-step="#{step}">#{text}</li>}
when :unordered
%{<li>#{text}</li>}
end
end
Then one could parse the first data-step in the contents passed to the list method to ensure that lists start at the given index. Or better yet, the gem could pass a new start parameter to the list method.
Either way, ordered lists continuing from an arbitrary index would then be possible, if they aren't already:
def list contents, list_type, start = 1
case list_type
when :ordered
%{<ol start="#{start}">#{contents}</ol>}
when :unordered
# ...
end
end
I've proposed PR #741 to support broken-up ordered lists without resetting the numbering.