Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add step parameter to #list_item #740

Open
dchacke opened this issue Aug 25, 2023 · 1 comment
Open

Add step parameter to #list_item #740

dchacke opened this issue Aug 25, 2023 · 1 comment

Comments

@dchacke
Copy link
Contributor

dchacke commented Aug 25, 2023

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
@dchacke
Copy link
Contributor Author

dchacke commented Aug 25, 2023

I've proposed PR #741 to support broken-up ordered lists without resetting the numbering.

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

No branches or pull requests

1 participant