raw标签¶
实例¶
折叠¶
例:
.. raw:: html
<details>
<summary><a>折叠</a></summary>
.. code-block:: python
lots_of_code = "能看见我吗?"
.. raw:: html
</details>
折叠
lots_of_code = "能看见我吗?"
文件读取¶
.. raw:: html
:file: raw.html
latex¶
例:
.. raw:: latex
\setlength{\parindent}{0pt}
例:
* H\ :sub:`2`\ O
* E = mc\ :sup:`2`
* :math:`E = mc^2`
H2O
E = mc2
其他¶
.. raw:: html
<script src="https://emgithub.com/embed.js?target=https%3A%2F%2Fgithub.com%2Ftal-tech%2Fgo-zero%2Fblob%2Fmaster%2Freadme.md%3Fplain%3D1%23L22-L25&style=github&showBorder=on&showLineNumbers=on&showFileMeta=on&showCopy=on"></script>
## 🤷 What is go-zero? English | [简体中文](readme-cn.md) <a href="https://trendshift.io/repositories/3263" target="_blank"><img src="https://trendshift.io/api/badge/repositories/3263" alt="zeromicro%2Fgo-zero | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
.. raw:: html
<div id="code-element"></div>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
axios({
method: 'get',
url: 'https://raw.githubusercontent.com/iotify/nsim-examples/master/functional-testing/alarm-server.js'
})
.then(function (response) {
document.getElementById("code-element").innerHTML = response.data;
});
</script>
// Important: Change the ##myuniquetopic## below to a unique string to prevent
// MQTT topic collision over public server.
// This a small server code which listens to a fire sensor and triggers alarm when
// temperature exceeds a certain threshold.
var mqtt = require('mqtt')
var client = mqtt.connect('mqtt://broker.hivemq.com:1883')
//!!!! Important - change the topic below to match the client settings !!!!!
const topic = '/[default]/temperature/0'
if (topic.includes('[default]')){
console.error('Did you forgot to change the topic?')
process.exit(0);
}
client.on('connect', function () {
client.subscribe(topic, function (err) {
if (err) {
console.error('Error subscribing to the topic');
}
else{
console.log('Subscribed to topic.')
}
})
})
client.on('message', function (topic, message) {
let cmd = JSON.parse(message.toString());
// Check if parsed payload is valid and contains temperature
if (cmd && cmd.temperature)
{
console.log("Received temperature "+cmd.temperature)
client.publish('/iotify/command/0', JSON.stringify({
alarm: (cmd.temperature > 80) ? true: false
}))
}
})
console.log("Running Simple MQTT test server")