Skip to content

Commit 6df4d3b

Browse files
Fix punctuation and formatting [ci-skip]
1 parent 9418b34 commit 6df4d3b

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

guides/source/api_documentation_guidelines.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ in the rails root directory, run `bundle install` and execute:
2323
$ bundle exec rake rdoc
2424
```
2525

26-
Resulting HTML files can be found in the ./doc/rdoc directory.
26+
Resulting HTML files can be found in the `./doc/rdoc` directory.
2727

28-
NOTE: Please consult the RDoc [Markup Reference][RDoc Markup] for help with the syntax.
28+
NOTE: Please consult the [RDoc Markup Reference][] for help with the syntax.
2929

3030
Links
3131
-----
3232

33-
Rails API documentation are not meant to be viewed on GitHub and therefore links should use the RDoc [`link`][RDoc Links] markup relative to the current API.
33+
Rails API documentation are not meant to be viewed on GitHub and therefore links should use the [RDoc link markup][] markup relative to the current API.
3434

3535
This is due to differences between GitHub Markdown and the generated RDoc that is published at [api.rubyonrails.org](https://api.rubyonrails.org) and [edgeapi.rubyonrails.org](https://edgeapi.rubyonrails.org).
3636

3737
For example, we use `[link:classes/ActiveRecord/Base.html]` to create a link to the `ActiveRecord::Base` class generated by RDoc.
3838

3939
This is preferred over absolute URLs such as `[https://api.rubyonrails.org/classes/ActiveRecord/Base.html]`, which would take the reader outside their current documentation version (e.g. edgeapi.rubyonrails.org).
4040

41-
[RDoc Markup]: https://ruby.github.io/rdoc/RDoc/MarkupReference.html
42-
[RDoc Links]: https://ruby.github.io/rdoc/RDoc/MarkupReference.html#class-RDoc::MarkupReference-label-Links
41+
[RDoc Markup Reference]: https://ruby.github.io/rdoc/RDoc/MarkupReference.html
42+
[RDoc link markup]: https://ruby.github.io/rdoc/RDoc/MarkupReference.html#class-RDoc::MarkupReference-label-Links
4343

4444
Wording
4545
-------
4646

47-
Write simple, declarative sentences. Brevity is a plus: get to the point.
47+
Write simple, declarative sentences. Brevity is a plus. Get to the point.
4848

4949
Write in present tense: "Returns a hash that...", rather than "Returned a hash that..." or "Will return a hash that...".
5050

@@ -110,7 +110,7 @@ Example Code
110110

111111
Choose meaningful examples that depict and cover the basics as well as interesting points or gotchas.
112112

113-
Use two spaces to indent chunks of code--that is, for markup purposes, two spaces with respect to the left margin. The examples themselves should use [Rails coding conventions](contributing_to_ruby_on_rails.html#follow-the-coding-conventions).
113+
For proper rendering, indent code by two spaces from the left margin. The examples themselves should use [Rails coding conventions](contributing_to_ruby_on_rails.html#follow-the-coding-conventions).
114114

115115
Short docs do not need an explicit "Examples" label to introduce snippets; they just follow paragraphs:
116116

@@ -177,7 +177,7 @@ For example,
177177

178178
### IRB
179179

180-
When documenting the behavior for IRB, Ruby's interactive REPL, always prefix commands with `irb>` and the output should be prefixed with `=>`.
180+
When documenting the behavior for IRB, Ruby's interactive REPL, always prefix commands with `irb>`. The output should be prefixed with `=>`.
181181

182182
For example,
183183

@@ -189,7 +189,7 @@ For example,
189189

190190
### Bash / Command-line
191191

192-
For command-line examples, always prefix the command with `$`, the output doesn't have to be prefixed with anything.
192+
For command-line examples, always prefix the command with `$`. The output doesn't have to be prefixed with anything.
193193

194194
```ruby
195195
# Run the following command:
@@ -200,11 +200,11 @@ For command-line examples, always prefix the command with `$`, the output doesn'
200200
Booleans
201201
--------
202202

203-
In predicates and flags prefer documenting boolean semantics over exact values.
203+
For predicates and flags, prefer documenting boolean semantics over exact values.
204204

205205
When "true" or "false" are used as defined in Ruby use regular font. The
206206
singletons `true` and `false` need fixed-width font. Please avoid terms like
207-
"truthy", Ruby defines what is true and false in the language, and thus those
207+
"truthy". Ruby defines what is true and false in the language, and thus those
208208
words have a technical meaning and need no substitutes.
209209

210210
As a rule of thumb, do not document singletons unless absolutely necessary. That
@@ -231,7 +231,7 @@ An example with a predicate:
231231
# +collection.size.zero?+. If the collection has not been loaded,
232232
# it is equivalent to +!collection.exists?+. If the collection has
233233
# not already been loaded and you are going to fetch the records
234-
# anyway it is better to check +collection.length.zero?+.
234+
# anyway, it is better to check +collection.length.zero?+.
235235
def empty?
236236
if loaded?
237237
size.zero?
@@ -242,18 +242,13 @@ end
242242
```
243243

244244
The API is careful not to commit to any particular value, the method has
245-
predicate semantics, that's enough.
245+
predicate semantics, which is sufficient.
246246

247247
File Names
248248
----------
249249

250250
As a rule of thumb, use filenames relative to the application root:
251-
252-
```
253-
config/routes.rb # YES
254-
routes.rb # NO
255-
RAILS_ROOT/config/routes.rb # NO
256-
```
251+
`config/routes.rb` instead of `routes.rb` or `RAILS_ROOT/config/routes.rb`.
257252

258253
Fonts
259254
-----
@@ -262,12 +257,12 @@ Fonts
262257

263258
Use fixed-width fonts for:
264259

265-
* Constants, in particular class and module names.
266-
* Method names.
267-
* Literals like `nil`, `false`, `true`, `self`.
268-
* Symbols.
269-
* Method parameters.
270-
* File names.
260+
* Constants, in particular class and module names
261+
* Method names
262+
* Literals like `nil`, `false`, `true`, `self`
263+
* Symbols
264+
* Method parameters
265+
* File names
271266

272267
```ruby
273268
class Array
@@ -281,7 +276,7 @@ end
281276

282277
WARNING: Using `+...+` for fixed-width font only works with simple content like
283278
ordinary classes, modules, method names, symbols, paths (with forward slashes),
284-
etc. Please use `<tt>...</tt>` for everything else.
279+
etc. Use `<tt>...</tt>` for everything else.
285280

286281
You can quickly test the RDoc output with the following command:
287282

0 commit comments

Comments
 (0)