Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix HTML and Markdown Support #431

Merged
merged 2 commits into from
Aug 29, 2021
Merged

Matrix HTML and Markdown Support #431

merged 2 commits into from
Aug 29, 2021

Conversation

caronc
Copy link
Owner

@caronc caronc commented Aug 21, 2021

Description:

Related issue (if applicable): #430

Added HTML and Markdown Support for the Matrix Plugin. It works the same way as the other plugins that support these formats. You simply just add ?format=html or ?format=markdown to your Apprise URL.

Another thing to consider with this new enhancement is that the Matrix Endpoints (server, webhook, t2bot, etc) do not support a title field. In the past, this was just tagged onto the message. This isn't really possible with HTML and Markdown formatted messages. So if you want the specified title to be visible in your body, reference {{app_title}} anywhere in the body. Think of {{app_title}} as a template token.

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

Testing

Anyone can help test this source code as follows:

# Create a virtual environment to work in
# This way you can just destroy it after when it's all over.
# The below will create a directory called apprise
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/caronc/apprise.git@430-matrix-html-support
# Give it a go:
# HTML Example (if you want to see the Title, you'll need to include it as part of your payload)
# The {{app_title}} is completely optional
apprise -t "Title" -b "<strong>{{app_title}}</strong><p>body</p>" "matrix://{user}:{pass}@{host}/?format=html"

# Markdown Example:
cat << _EOF | apprise -t "Egg Details" -b "matrix://{user}:{pass}@{host}/?format=markdown"
# {{app_title}}
## Ways to Prepare Eggs
* Scrambled
* Sunny Side Up
* Over Easy

There is more, but I want to keep my message short. :)
_EOF

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2021

Codecov Report

Merging #431 (6da94ad) into master (bb7c771) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #431   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           95        95           
  Lines        12118     12131   +13     
  Branches      2040      2045    +5     
=========================================
+ Hits         12118     12131   +13     
Impacted Files Coverage Δ
apprise/plugins/NotifyMatrix.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb7c771...6da94ad. Read the comment docs.

@MartenBE
Copy link

I have tested this briefly and it seems to work as expected on first glance. Thank you for implementing this!

@caronc caronc merged commit a888b85 into master Aug 29, 2021
@caronc caronc deleted the 430-matrix-html-support branch September 19, 2021 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants