Skip to content

Extend the ListItem interface with ordered and index #3359

Open
@pejas

Description

Describe the feature
Extend the ListItem interface with two additional fields:

{
  ordered: boolean;
  index: number;
}
  • 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 the listitem:

{
  listitem(text: string, task: boolean, checked: boolean): string {
    return text.trim() + '__LIST_ITEM__';
  },
  list(body: string, ordered: boolean, start: number | ''): string {
    const items = body.split('__LIST_ITEM__');
    // Ugly workaround
  }
}

I have reviewed the marked.js code and believe that this feature should be straightforward to implement.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions