Open pejas opened 3 months ago
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
That sounds good to me. Do you want to create a PR to implement it?
Yes, I do. I will prepare a PR with the described change.
This could also be done with walkTokens. Something like:
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 https://github.com/markedjs/marked/issues/3359#issuecomment-2209320597 for a way to add properties with an extension. Or feel free to submit a PR to add the properties
@pejas @tmatheas @UziTech Has this issue been resolved.If not, I would like to work on this issue.
@pejas @tmatheas @UziTech Has this issue been resolved.If not, I would like to work on this issue.
Feel free I've used a walk tree workaround and this ticket just sits in my backlog with a low priority.
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.