diff --git a/hardware/wemo/package.json b/hardware/wemo/package.json index 50120c12..c9c0c425 100644 --- a/hardware/wemo/package.json +++ b/hardware/wemo/package.json @@ -17,7 +17,7 @@ "name": "Benjamin Hardill", "url": "http://www.hardill.me.uk/wordpress/" }, - "license": "APACHE-2.0", + "license": "Apache-2.0", "dependencies": { "node-ssdp": "~3.2.5", "request": "~2.74.0", diff --git a/parsers/markdown/70-markdown.html b/parsers/markdown/70-markdown.html new file mode 100644 index 00000000..befc415f --- /dev/null +++ b/parsers/markdown/70-markdown.html @@ -0,0 +1,32 @@ + + + + + + diff --git a/parsers/markdown/70-markdown.js b/parsers/markdown/70-markdown.js new file mode 100644 index 00000000..a60d63f0 --- /dev/null +++ b/parsers/markdown/70-markdown.js @@ -0,0 +1,17 @@ + +module.exports = function(RED) { + "use strict"; + var markdownNode = function(n) { + var md = require('markdown-it')({html:true, linkify:true}); + RED.nodes.createNode(this,n); + var node = this; + //
'; + node.on("input", function(msg) { + if (msg.payload !== undefined && typeof msg.payload === "string") { + msg.payload = md.render(msg.payload); + } + node.send(msg); + }); + } + RED.nodes.registerType("markdown",markdownNode); +} diff --git a/parsers/markdown/LICENSE b/parsers/markdown/LICENSE new file mode 100644 index 00000000..599d3131 --- /dev/null +++ b/parsers/markdown/LICENSE @@ -0,0 +1,13 @@ +Copyright 2019 JS Foundation and other contributors, https://js.foundation/ + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/parsers/markdown/README.md b/parsers/markdown/README.md new file mode 100644 index 00000000..e07e7f24 --- /dev/null +++ b/parsers/markdown/README.md @@ -0,0 +1,16 @@ +node-red-node-markdown +====================== + +A Node-RED node to convert a markdown string to html. + +Install +------- + +Run the following command in your Node-RED user directory - typically `~/.node-red` + + npm install node-red-node-markdown + +Usage +----- + +If the input is a string it tries to convert it into an html string. diff --git a/parsers/markdown/icons/parser-markdown.png b/parsers/markdown/icons/parser-markdown.png new file mode 100644 index 00000000..7bae4f04 Binary files /dev/null and b/parsers/markdown/icons/parser-markdown.png differ diff --git a/parsers/markdown/package.json b/parsers/markdown/package.json new file mode 100644 index 00000000..4c2c70fa --- /dev/null +++ b/parsers/markdown/package.json @@ -0,0 +1,24 @@ +{ + "name" : "node-red-node-markdown", + "version" : "0.0.1", + "description" : "A Node-RED node to convert a markdown string to html.", + "dependencies" : { + "markdown-it": "^8.4.2" + }, + "repository" : { + "type":"git", + "url":"https://github.com/node-red/node-red-nodes/tree/master/parsers/markdown" + }, + "license": "Apache-2.0", + "keywords": [ "node-red", "markdown" ], + "node-red" : { + "nodes" : { + "markdown": "70-markdown.js" + } + }, + "author": { + "name": "Dave Conway-Jones", + "email": "ceejay@vnet.ibm.com", + "url": "http://nodered.org" + } +}