Enable Markdown and HTML notifications. (#288)

This change enable defining the notification body as HTML or Markdown. This can be very
useful to have more user-friendly notifications such as:
* applying a heading style to the `{watch_title}` to make it stand out
* creating clickable links using the `{watch_url}`, `{preview_url}` and `{diff_url}`.

Changes
=======
* Add a `notification_format` to the notification settings, defaults to plain text.
* Use the `body_format` parameter of Apprise's `notify` method.

Co-authored-by: Malo Jaffré <malo.jaffre@dunnhumby.com>
This commit is contained in:
ghjklw
2021-12-04 14:41:48 +01:00
committed by GitHub
parent ff6dc842c0
commit ecba130fdb
7 changed files with 37 additions and 5 deletions

View File

@@ -56,6 +56,7 @@ def test_check_notification(client, live_server):
"Diff URL: {diff_url}\n"
"Snapshot: {current_snapshot}\n"
":-)",
"notification_format": "Text",
"url": test_url,
"tag": "my tag",
"title": "my title",
@@ -181,6 +182,7 @@ def test_check_notification(client, live_server):
url_for("settings_page"),
data={"notification_title": "New ChangeDetection.io Notification - {watch_url}",
"notification_body": "Rubbish: {rubbish}\n",
"notification_format": "Text",
"notification_urls": "json://foobar.com",
"minutes_between_check": 180,
"fetch_backend": "html_requests"
@@ -188,4 +190,4 @@ def test_check_notification(client, live_server):
follow_redirects=True
)
assert bytes("is not a valid token".encode('utf-8')) in res.data
assert bytes("is not a valid token".encode('utf-8')) in res.data