Skip to content

<br/> Tag does not product /n #1090

Open
@tolotrasamuel

Description

@tolotrasamuel

Code:


import 'package:html/parser.dart';

class HtmlUtil{
  String? toPlainTxt(String htmlString) {
    final document = parse(htmlString);
    final parsedString = parse(document.body?.text).documentElement?.text;

    return parsedString;
  }
}

Input:
<p>Hello<br/><span style="color:#f00">This is colorful</span></p>

Output:
HelloThis is colorful

Expected:
Hello\nThis is colorful
Screenshot 2024-08-01 at 2 15 38 AM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions