Skip to content

Commit

Permalink
release v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed May 18, 2022
1 parent 6b6b186 commit a64e5e0
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cSpell.words": [
"bgcolor",
"blockquote",
"Blockquotes",
"linebreak"
]
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.0.0
- New `preferPlainText` option to use the mime message's plain text instead of the html part when available.
- Convert HTML line-breaks to plain text line-breaks when calling `HtmlToPlainTextConverter.convert(String html);`
- New `enableDarkMode` option to improve dark mode display for older browser engines
- Ensure compatibility with enough_mail 2.0.0
- Improve documentation


## 1.3.0
- Do not include the `enough_mail` package automatically to keep documentation simpler

Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import 'package:enough_mail_html/enough_mail_html.dart';
String generateHtml(MimeMessage mimeMessage) {
return mimeMessage.transformToHtml(
blockExternalImages: false, emptyMessageText: 'Nothing here, move on!');
blockExternalImages: false,
emptyMessageText: 'Nothing here, move on!',
);
}
String generatePlainText(String htmlText) {
Expand Down Expand Up @@ -45,7 +47,8 @@ String playYourself(MimeMessage mimeMessage) {
blockExternalImages: true,
emptyMessageText: 'Nothing here, move on!',
customDomTransformers: [StyleTextDomTransformer()],
customValues: {'textStyle': 'font-size:10px;font-family:verdana;'});
customValues: {'textStyle': 'font-size:10px;font-family:verdana;'},
);
return mimeMessage.transformToHtml(transformConfiguration: cfg);
}
Expand All @@ -63,14 +66,19 @@ class StyleTextDomTransformer extends DomTransformer {
```

## Installation
Add this dependency your pubspec.yaml file:
Add this dependency your `pubspec.yaml` file:

```
dependencies:
enough_mail_html: ^1.3.0
enough_mail_html: ^2.0.0
```
The latest version or `enough_mail_html` is [![enough_mail_html version](https://img.shields.io/pub/v/enough_mail_html.svg)](https://pub.dartlang.org/packages/enough_mail_html).

Note: you might need to set a dependency override for the xml package:
```
dependency_overrides:
xml: ^6.0.1
```

## Features and bugs

Expand Down
13 changes: 8 additions & 5 deletions example/enough_mail_html_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ String generatePlainText(String htmlText) =>

String configureImageBlockingOrEmptyMessage(MimeMessage mimeMessage) =>
mimeMessage.transformToHtml(
blockExternalImages: true, emptyMessageText: 'Nothing here, move on!');
blockExternalImages: true,
emptyMessageText: 'Nothing here, move on!',
);

Future<String> playYourself(MimeMessage mimeMessage) async {
final cfg = TransformConfiguration.create(
blockExternalImages: true,
emptyMessageText: 'Nothing here, move on!',
customDomTransformers: [StyleTextDomTransformer()],
customValues: {'textStyle': 'font-size:10px;font-family:verdana;'});
blockExternalImages: true,
emptyMessageText: 'Nothing here, move on!',
customDomTransformers: [StyleTextDomTransformer()],
customValues: {'textStyle': 'font-size:10px;font-family:verdana;'},
);
return mimeMessage.transformToHtml(transformConfiguration: cfg);
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class HtmlToPlainTextConverter {
}
}

//cSpell:disable
/// A map of all HTML 4.01 character entities
/// and their corresponding characters.
/// Taken from https://github.com/james-alex/html_character_entities/blob/master/lib/src/html_character_entities.dart
Expand Down
15 changes: 8 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
name: enough_mail_html
description: Generate HTML from an email mime message and creates plain text from HTML. Eases handling of `MimeMessage` in the `enough_mail` package.
version: 1.3.0
version: 2.0.0
homepage: https://github.com/Enough-Software/enough_mail_html

environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
enough_mail: # ^1.3.6
git:
url: https://github.com/Enough-Software/enough_mail.git
enough_mail: ^2.0.0
html: ^0.15.0
image: ^3.1.1
image: ^3.1.3

dependency_overrides:
# outcomment for local development
xml: ^6.0.1
# out-comment for git or local development
# enough_mail:
# git:
# url: https://github.com/Enough-Software/enough_mail.git
# path: ../enough_mail/

dev_dependencies:
lints: ^1.0.1
lints: ^2.0.0
test: ^1.16.7
3 changes: 1 addition & 2 deletions test/enough_mail_html_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ void main() {
setUp(() {});

test('Parse and adapt documents', () {
const html =
'''
const html = '''
<html>
<body>
<p>hello world</p>
Expand Down

0 comments on commit a64e5e0

Please sign in to comment.