mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-12-27 07:21:08 +01:00
* Update 70-markdown.html * Update 70-markdown.js * Update package.json * Update 70-markdown.html * Update 70-markdown.js
48 lines
1.7 KiB
HTML
48 lines
1.7 KiB
HTML
|
|
<script type="text/html" data-template-name="markdown">
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-property"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
|
|
<input type="text" id="node-input-property" style="width:70%;"/>
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/html" data-help-name="markdown">
|
|
<p>A function that converts the <code>msg.payload</code> in markdown format to html.</p>
|
|
<p>If the input is a string it converts it to html.</p>
|
|
<p>All other message types are ignored.</p>
|
|
<p>Uses the markdown-it library - You can see a demo
|
|
<a href="https://markdown-it.github.io/">here</a>.</p>
|
|
<p>It is configured with html, linkify and typographer options turned on.</p>
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('markdown',{
|
|
category: 'parser',
|
|
color:"#DEBD5C",
|
|
defaults: {
|
|
name: {value:""},
|
|
property: {value:"payload",required:true}
|
|
},
|
|
inputs:1,
|
|
outputs:1,
|
|
icon: "parser-markdown.png",
|
|
label: function() {
|
|
return this.name||("msg." + this.property)||"markdown";
|
|
},
|
|
labelStyle: function() {
|
|
return this.name?"node_label_italic":"";
|
|
},
|
|
oneditprepare: function() {
|
|
if (this.property === undefined) {
|
|
$("#node-input-property").val("payload");
|
|
}
|
|
$("#node-input-property").typedInput({default:'msg',types:['msg']});
|
|
}
|
|
});
|
|
</script>
|