Skip to content

Enabled markdown support in matrix sender node #4

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions matrixbot/99-matrixbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = function(RED) {
"use strict";

var sdk = require("matrix-js-sdk");
var md = require("markdown-it")();

// --------------------------------------------------------------------------------------------
// The configuration node holds the configuration and credentials for all nodes.
Expand Down Expand Up @@ -146,7 +147,7 @@ module.exports = function(RED) {
return;
}

node.configNode.matrixClient.sendTextMessage(destRoom, msg.payload.toString())
node.configNode.matrixClient.sendHtmlMessage(destRoom, msg.payload.toString(), md.render(msg.payload.toString()))
.then(function() {
node.log("Message sent: " + msg.payload);
}).catch(function(e){
Expand Down Expand Up @@ -299,4 +300,4 @@ module.exports = function(RED) {

RED.nodes.registerType("matrix command", MatrixCommandNode);

}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "node-red-contrib-matrixbot",
"version": "0.0.2",
"version": "0.0.3",
"description": "Matrix bot nodes for Node-RED",
"dependencies": {
"matrix-js-sdk": "^0.5.4"
"matrix-js-sdk": "^0.5.4",
"markdown-it": "^8.4.1"
},
"node-red": {
"nodes": {
Expand Down