浏览代码

Add Markdoen guidelines

Alois Mahdal 10 年前
父节点
当前提交
967203e9e8
共有 2 个文件被更改,包括 118 次插入0 次删除
  1. 6
    0
      README.md
  2. 112
    0
      guidelines/markdown.md

+ 6
- 0
README.md 查看文件

@@ -3,6 +3,12 @@ My Book
3 3
 
4 4
 Set of my more-or-less proven guidelines, best practices and (coding) styles.
5 5
 
6
+Index
7
+-----
8
+
9
+ *  [Markdown](guidelines/markdown.md)
10
+
11
+
6 12
 Author
7 13
 ------
8 14
 

+ 112
- 0
guidelines/markdown.md 查看文件

@@ -0,0 +1,112 @@
1
+Markdown guidelines
2
+===================
3
+
4
+Markdown is very flexible.  To ensure this flexibility does not help
5
+create inconsistencies, I try to adhere to following guidelines. These
6
+are not meant as strict rules, but rather set of hints, and reminders
7
+for myself next time I forget how do I do spacing etc.
8
+
9
+The guidelines take only original MD into account.
10
+
11
+
12
+Generic
13
+-------
14
+
15
+ *  Wrap at 75 columns at most (*fmt(1)* default).  Wrapping to less can
16
+    be beneficial (e.g. for re-quoting or in block comments) but less
17
+    than 61 is not considered sane.
18
+
19
+ *  Try to have 2 spaces after sentence.
20
+
21
+ *  Avoid huge paragraphs.
22
+
23
+ *  Avoid tiny paragraphs (except as a means of emphasis)
24
+
25
+ *  Avoid "strong" like the plague (rule of thumb: max. once per page).
26
+
27
+
28
+Headings
29
+--------
30
+
31
+ *  Use `===`, `---`, `###`, `####` for H1, H2, H3...
32
+
33
+ *  For #-based headings, append hashes also after the heading text
34
+    (e.g. `### Foo ###`, not `### Foo`)
35
+
36
+ *  Have 2 empty lines before each heading, 1 empty line after
37
+
38
+ *  In longer step-by-step howtos, consider using numbered headings
39
+    instead of lists.
40
+
41
+
42
+Lists
43
+-----
44
+
45
+ *  Make sure to have empty line before and after.
46
+
47
+ *  Except for very simple lists where all items are just few words,
48
+    add one empty line between items.
49
+
50
+ *  Align 2nd line and the rest to 4 spaces, (i.e. the previous
51
+    alignment plus 4 spaces).
52
+
53
+ *  For unordered lists, use asterisk, at least for the first level.
54
+
55
+ *  Optimal spacing is 1 space, asterisk, 2 spaces, e.g. ` *  foo`.
56
+
57
+ *  For ordered lists, optimal spacing is one or zero spaces in front
58
+    of the number, then one space, e.g. ` 9. Foo`, then `10. Bar`.
59
+
60
+
61
+Jargon names
62
+------------
63
+
64
+ *  For IT-related texts, variable names, underscores, tool names,
65
+    filenames are considered as "jargon", which falls into the typical
66
+    case for emphasized text.
67
+
68
+ *  However, if the text is (or should be, by author's opinion)
69
+    represented as code, backticks may be better choice.
70
+
71
+
72
+Links
73
+-----
74
+
75
+ *  Use reference-style, i.e. `[link text][1]` and then, after paragraph
76
+    (or later if that makes sense), use `  [1]: http://www.foo.../`.
77
+
78
+ *  Note that you don't need to use numbers: keyword is OK (even spaced),
79
+    but *keep it consistent within the document*.
80
+
81
+ *  You can also use `[link][]`; here the keyword = link text (i.e.
82
+    `  [link]: http://whatever` would follow).
83
+
84
+ *  Links can be local (although I have only used this in Github).
85
+
86
+
87
+Images
88
+------
89
+
90
+ *  Needless to say, they make no sense in plain text.  Otherwise
91
+    look at official Markdown specs.
92
+
93
+
94
+Code
95
+----
96
+
97
+ *  Remember that you can have code blocks in lists (step-by-step
98
+    howtos) and even in quotations:
99
+
100
+        John [said][1]:
101
+
102
+        > Always call `foo()` before `bar()`:
103
+        >
104
+        >     foo();
105
+        >     bar();
106
+        >
107
+        > and *everything* will work.
108
+
109
+ *  Try for copy/paste-able code i.e. avoid prompt char (`$`, `%`, `%`)
110
+    unless you are pasting *output*.  To convey the need of root privilege,
111
+    mention that in surrounding text or use *sudo*.
112
+