Skip to content

Commit d34df37

Browse files
committed
Add styleguide
1 parent ec14dad commit d34df37

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

styleguide.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
layout: default
3+
title: Cookbook Style Guide
4+
---
5+
6+
The cookbook recipes are intended to be task-focused guides to solving specific
7+
problems.
8+
9+
They should follow a standard structure. Lines beginning with `>` are comments
10+
that should be removed:
11+
12+
~~~~~markdown
13+
---
14+
layout: default
15+
title: A short (<10 words) summary of the task addressed
16+
---
17+
18+
### Problem
19+
> A description of the problem solved by this recipe. It should be phrased as:
20+
You want to do X.
21+
22+
### Solution
23+
> A description of the solution (the 'how') without going into too much detail (the 'why').
24+
Use the <code class="node">Inject</code> node to do X.
25+
26+
#### Example
27+
> The recipe should provide an example of the solution to illustrate it in action.
28+
29+
![](/images/flow-image.png)
30+
31+
> Paste a sample flow json that can be imported by the reader
32+
~~~json
33+
[{"id":"7c87b536.83784c","type":"inject","z":"55635136.aa9cb","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":80,"wires":[["7de918a6.8216e8"]]}]
34+
~~~
35+
{: .flow}
36+
37+
> If the recipe can be meaningfully demonstrated in action via static text, add it here.
38+
39+
### Discussion
40+
> A more detailed discussion of the solution and additional relevant information
41+
> that will help the reader apply it to their own scenario.
42+
The <code class="node">Inject</code> node code can be configured to do X. This
43+
means it can...
44+
45+
~~~~~
46+
47+
The following styles should be used consistently.
48+
49+
#### Message properties
50+
51+
Message properties should be enclosed in back-ticks:
52+
53+
~~~~~markdown
54+
Use the `msg.payload` property to ...
55+
~~~~~
56+
57+
#### Node types
58+
59+
When a specific node type is mentioned, it should be styled as:
60+
61+
~~~~~markdown
62+
Use the <code class="node">HTTP In</code> node to ...
63+
~~~~~
64+
65+
#### Example flows
66+
67+
~~~~~markdown
68+
~~~json
69+
> insert flow json here. It should be minified and on a single line.
70+
~~~
71+
{: .flow}
72+
~~~~~
73+
74+
#### Terminal output
75+
76+
~~~~~markdown
77+
~~~text
78+
[~]$ date
79+
Mon 28 Nov 2016 10:55:48 GMT
80+
~~~
81+
{: .shell}
82+
~~~~~
83+
84+
#### JavaScript samples
85+
86+
~~~~~markdown
87+
~~~javascript
88+
var name = msg.payload.name;
89+
~~~
90+
~~~~~
91+
92+
#### JSON samples
93+
94+
~~~~~markdown
95+
~~~json
96+
{
97+
"name": "Nick"
98+
}
99+
~~~
100+
~~~~~

0 commit comments

Comments
 (0)