Skip to content

Commit 3333dc9

Browse files
committed
added style guidelines to readme
1 parent 8ad89e8 commit 3333dc9

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
# Style Guidelines
3+
4+
## Prose Style & Grammar
5+
6+
###Sentence Structure
7+
8+
* Write in clear, easy-to-understand statements.
9+
* Keep sentences short and to the point.
10+
11+
###Spelling
12+
* The documentation standardizes on American English spelling. For example:
13+
* **Yes**: color, while, among, customize
14+
* **No**: colour, whilst, amongst, customise
15+
16+
### Pronoun Usage
17+
* Use second-person pronoun ("you") when necessary, but try to avoid it.
18+
* Favor the definite article ("the") over second-person possesive ("your").
19+
* **Yes**: Insert the paragraph after the unordered list.
20+
* **No**: Insert your paragraph after the unordered list.
21+
* When editing current entries, change first-person plural pronouns ("we," "our," "us") to second-person.
22+
* **Yes**: The `.insertAfter()` method here adds an unordered list beneath the paragraph.
23+
* **No**: And now we have our paragraph beneath the unordered list.
24+
25+
### "Voice"
26+
* Prefer active voice over passive.
27+
* **Active**: Calling `.click()` binds a click handler to the elements in the collection
28+
* **Passive**: Click handlers are bound to elements in the collection when `.click()` is called
29+
30+
## Code Style
31+
Code in the API documentation should follow the [jQuery Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines) with the following addition and exception:
32+
33+
* **Document ready syntax**: Use `$( document ).ready(function() {` instead of `$(function() {` as it's harder for new users to distinguish the difference between the latter and an IIFE.
34+
* **Indentation**: Core guidelines say to use tabs. In API documentation, *use 2 spaces instead*. This helps keep the line width manageable and avoid horizontal scrollbars.
35+
36+
### Code within prose content (paragraphs and the like):
37+
* Methods: use a dot, followed by the method name, followed by parentheses: e.g. The `.focus()` method is a shortcut for `.bind('focus', handler)` in the first and second variations, and `.trigger('focus')` in the third.
38+
* Properties: use a dot, followed by the property name: e.g. `.length`.
39+
* Functions: use the function name, followed by parentheses: `myFunction()`.
40+
41+
### Examples
42+
* Examples should indicate what the expected result will be before presenting the code. This makes code clearer and skimming easier, especially for newer coders who may not understand what is supposed to be happening from reading the code itself.
43+
* **Yes**: Find all p elements that are children of a div element and apply a border to them.
44+
* **No**: Find all p elements that are children of a div element.
45+
* Make your example easy to follow with good comments so that the explanation isn't necessary.
46+
47+
## Rhetorical Context
48+
* Subject
49+
* The entirety of jQuery's public API
50+
* Audience
51+
* jQuery users
52+
* International: Native and non-native English readers
53+
* Experience Level: Absolute beginner through expert
54+
* First-time through frequent consumers of site
55+
* Purpose
56+
* Describe comprehensively and accessibly every public method, property, and selector in the jQuery library
57+
* Reinforce understanding of concepts through relevant code examples
58+
* Demonstrate the effect the methods have by executing code examples
59+
* Authors
60+
* Proficient in JavaScript development
61+
* Well versed in jQuery best practices
62+
* Strong in English writing
63+
* Tone
64+
* Middle ground between formal and familiar. Err on the side of formality.
65+
* Authoritive
66+
* Tactful
67+

0 commit comments

Comments
 (0)