Skip to content

Commit

Permalink
Chore: add more documentation about trimText feat
Browse files Browse the repository at this point in the history
  • Loading branch information
CatHood0 committed Aug 17, 2024
1 parent 3dc2450 commit 5e66b2f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion lib/parser/html_to_delta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,35 @@ class HtmlToDelta {
/// Converts HTML tags to Delta operations based on defined rules.
late HtmlOperations htmlToOp;

/// Optionally trims converted text
/// ## Optionally trims converted text
///
/// This could cause some **unexpected** behaviors since we cannot
/// recognize which part must be remove, like the **before append any html tag**
///
/// ### Example
///
/// Assume that you have a HTML like this:
///
///```html
/// <body>
/// <p>This is a paragraph</p>
/// <p>This is another paragraph</p>
/// </body>
///```
///
/// If [trimText] is false the leading spaces wont be removed
/// and return a Delta with unexpected spaces like:
///
///```dart
/// [
/// {"insert":" This is a paragraph\n"},
/// {"insert":" This is another paragraph\n"}
/// ]
///```
///
/// It's highly recommended that if you have a html on multiple lines
/// then remove all new lines to make more simple to the parser works
/// as expect. HtmlToDelta works better with a single line html code
final bool trimText;

/// Creates a new instance of HtmlToDelta.
Expand Down

0 comments on commit 5e66b2f

Please sign in to comment.