Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.75k stars 805 forks source link

[BUG] "0" is added in every <li> tag #1389

Open Vignesh-Dart opened 6 months ago

Vignesh-Dart commented 6 months ago

"0" is added in every list tag:

HTML to reproduce the issue:

`var data1 = '''

  • One
  • \r\n
  • Two
  • \r\n
  • Three
  • ''';`

    Html widget configuration:

    Html( data: data1, style: { "html": Style( fontSize: FontSize(15.1), fontWeight: FontWeight.w500, ), }, ),

    Expected behavior:

    Remove "0" in every <li> tag

    Screenshots:

    image

    Versions:

    flutter_html: ^3.0.0-beta.2

    timothyrobb commented 6 months ago

    @Vignesh-Dart If you pass invalid HTML to an HTML renderer, of course it'll have unexpected results. The code assumes an Ordered List (<ol>) for all List Item tags (<li>), but without a parent wrapping tag, it can't tell how many are in the list. '''<ol><li>One</li>\r\n<li>Two</li>\r\n<li>Three</li></ol>''' Should give you

    1. One
    2. Two
    3. Three

    Or '''<ul><li>One</li>\r\n<li>Two</li>\r\n<li>Three</li></ul>''' Should give you:

    • One
    • Two
    • Three