当选中一个节点时,其帮助文本会显示在信息选项卡中。该帮助内容应为用户提供使用该节点所需的所有信息。
以下风格指南描述了帮助文档应如何结构化,以确保各节点间呈现一致的外观。
Since 2.1.0 : The help text can be provided as markdown rather than HTML. In this
case the type
attribute of the
<p>
)
is used as the tooltip when hovering over the node in the palette.
连接到MQTT代理并发布消息。
本节提供关于节点的更详细信息。它应解释如何使用该节点,并对其输入/输出提供更多说明。
msg.payload
用作发布消息的有效载荷。
如果包含对象(Object),将在发送前转换为JSON字符串。
如果包含二进制缓冲区(Buffer),消息将按原样发布。
使用的主题可以在节点中配置,如果留空,也可以通过msg.topic
来设置。
同样,QoS和保留值可以在节点中配置,如果留空,则分别由msg.qos
和msg.retain
设置。
本部分可用于提供外部资源的链接,例如:
msg.tweet
属性上面的示例是通过以下方式创建的:
<script type="text/html" data-help-name="node-type">
<p>Connects to a MQTT broker and publishes messages.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string | buffer</span>
</dt>
<dd> the payload of the message to publish. </dd>
<dt class="optional">topic <span class="property-type">string</span></dt>
<dd> the MQTT topic to publish to.</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Standard output
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard output of the command.</dd>
</dl>
</li>
<li>Standard error
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard error of the command.</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p><code>msg.payload</code> is used as the payload of the published message.
If it contains an Object it will be converted to a JSON string before being sent.
If it contains a binary Buffer the message will be published as-is.</p>
<p>The topic used can be configured in the node or, if left blank, can be set
by <code>msg.topic</code>.</p>
<p>Likewise the QoS and retain values can be configured in the node or, if left
blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p>
<h3>References</h3>
<ul>
<li><a>Twitter API docs</a> - full description of <code>msg.tweet</code> property</li>
<li><a>GitHub</a> - the nodes github repository</li>
</ul>
</script>
<script type="text/markdown" data-help-name="node-type">
Connects to a MQTT broker and publishes messages.
### Inputs
: payload (string | buffer) : the payload of the message to publish.
: *topic* (string) : the MQTT topic to publish to.
### Outputs
1. Standard output
: payload (string) : the standard output of the command.
2. Standard error
: payload (string) : the standard error of the command.
### Details
`msg.payload` is used as the payload of the published message.
If it contains an Object it will be converted to a JSON string before being sent.
If it contains a binary Buffer the message will be published as-is.
The topic used can be configured in the node or, if left blank, can be set
`msg.topic`.
Likewise the QoS and retain values can be configured in the node or, if left
blank, set by `msg.qos` and `msg.retain` respectively.
### References
- [Twitter API docs]() - full description of `msg.tweet` property
- [GitHub]() - the nodes github repository
</script>
每个部分必须用标签标记。如果
Details
部分需要子标题,必须使用标签。
<h3>Inputs</h3>
...
<h3>Details</h3>
...
<h4>A sub section</h4>
...
### Inputs
...
### Details
...
#### A sub section
...
消息属性列表使用
标签标记。该列表必须包含一个message-properties
的类属性。
列表中的每个项目由一对和
标签组成。
每个包含属性名称和可选的
,后者包含该属性的预期类型。如果属性是可选的,
应具有
optional
类属性。
每个包含该属性的简要描述。
<dl class="message-properties">
<dt>payload
<span class="property-type">string | buffer</span>
</dt>
<dd> the payload of the message to publish. </dd>
<dt class="optional">topic
<span class="property-type">string</span>
</dt>
<dd> the MQTT topic to publish to.</dd>
</dl>
: payload (string | buffer) : the payload of the message to publish.
: *topic* (string) : the MQTT topic to publish to.
如果节点有多个输出端口,每个输出都应拥有自己的消息属性列表,如上所述。这些列表应包裹在带有node-ports
类属性的
有序列表中
列表中的每一项应包含输出的简要描述,后跟一个
消息属性列表。
注意: 如果该节点只有一个输出,则不应将其包装在此类列表中,只需使用
标签即可。
<ol class="node-ports">
<li>Standard output
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard output of the command.</dd>
</dl>
</li>
<li>Standard error
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard error of the command.</dd>
</dl>
</li>
</ol>
1. Standard output
: payload (string) : the standard output of the command.
2. Standard error
: payload (string) : the standard error of the command.
当引用上述消息属性列表之外的消息属性时,应为其添加msg.
前缀,以便读者清楚其含义。这些引用应当包裹在标签中。
The interesting part is in <code>msg.payload</code>.
The interesting part is in `msg.payload`.
帮助文本正文中不应使用其他样式标记(例如、
)。
帮助文档不应假设读者是经验丰富的开发者或对所涉及节点非常熟悉;最重要的是,它需要提供实际帮助。
Node-RED: 面向事件驱动应用的低代码编程平台。
版权所有 OpenJS基金会 及 Node-RED 贡献者。保留所有权利。OpenJS基金会 拥有注册商标并使用商标。有关 OpenJS基金会 的商标列表,请参阅我们的 商标政策 和 商标列表。未在 OpenJS基金会商标列表 中标注的商标™或注册®商标归其各自持有人所有。使用这些商标并不意味着与它们有任何关联或获得其认可。
The OpenJS Foundation | 使用条款 | 隐私政策 | OpenJS基金会章程 | 商标政策 | 商标列表 | Cookie政策