-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Extend the ListItem interface with ordered and index #3359
Comments
That sounds good to me. Do you want to create a PR to implement it? |
This could also be done with walkTokens. Something like: const walkTokens = (token) => {
if (token.type === 'list') {
token.listItems.forEach((item, idx) => {
item.ordered = token.ordered;
item.index = idx;
})
}
}
marked use({walkTokens}) with marked v13+ the whole token is sent to the renderer so any changes in walkTokens will make it to the renderer |
Yes, I do. I will prepare a PR with the described change.
Thank you, it will look much better for the time being. |
@pejas Have you fixed this issue ? |
@tmatheas this is not fixed in marked See #3359 (comment) for a way to add properties with an extension. Or feel free to submit a PR to add the properties |
Describe the feature
Extend the ListItem interface with two additional fields:
ordered
: Indicates whether the parent List is ordered.index
: Represents the starting index plus the item's index.Why is this feature necessary?
Android's TextView does not support ordered lists natively. To work around this limitation, I need to simulate ordered lists using
<span>
and<br/>
tags. This feature will facilitate that process. You can find more details in the Styling with HTML markup documentation.Describe alternatives you've considered
Currently, I have to parse the body of the
list
and manually mark each item in thelistitem
:I have reviewed the marked.js code and believe that this feature should be straightforward to implement.
The text was updated successfully, but these errors were encountered: