Skip to content

Commit ca03c36

Browse files
jrstjohngitster
authored andcommitted
State correct usage of literal examples in man pages in the coding standards
The man pages contain inconsistent usage of backticks vs. single quotes around options, commands, etc. that are in paragraphs. This commit states that backticks should always be used around literal examples. This commit states that "--" and friends should not be escaped (e.g. use `--pretty=oneline` instead of `\--pretty=oneline`). This commit also states correct usage for typesetting command usage examples with inline substitutions. Thanks-to: Ramkumar Ramachandra <[email protected]> Thanks-to: Stuart Rackham <[email protected]> Thanks-to: Junio C Hamano <[email protected]> Signed-off-by: Jason St. John <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d7d2c87 commit ca03c36

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

Documentation/CodingGuidelines

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,11 @@ Writing Documentation:
244244

245245
Every user-visible change should be reflected in the documentation.
246246
The same general rule as for code applies -- imitate the existing
247-
conventions. A few commented examples follow to provide reference
248-
when writing or modifying command usage strings and synopsis sections
249-
in the manual pages:
247+
conventions.
248+
249+
A few commented examples follow to provide reference when writing or
250+
modifying command usage strings and synopsis sections in the manual
251+
pages:
250252

251253
Placeholders are spelled in lowercase and enclosed in angle brackets:
252254
<file>
@@ -296,3 +298,29 @@ Writing Documentation:
296298
Use 'git' (all lowercase) when talking about commands i.e. something
297299
the user would type into a shell and use 'Git' (uppercase first letter)
298300
when talking about the version control system and its properties.
301+
302+
A few commented examples follow to provide reference when writing or
303+
modifying paragraphs or option/command explanations that contain options
304+
or commands:
305+
306+
Literal examples (e.g. use of command-line options, command names, and
307+
configuration variables) are typeset in monospace, and if you can use
308+
`backticks around word phrases`, do so.
309+
`--pretty=oneline`
310+
`git rev-list`
311+
`remote.pushdefault`
312+
313+
Word phrases enclosed in `backtick characters` are rendered literally
314+
and will not be further expanded. The use of `backticks` to achieve the
315+
previous rule means that literal examples should not use AsciiDoc
316+
escapes.
317+
Correct:
318+
`--pretty=oneline`
319+
Incorrect:
320+
`\--pretty=oneline`
321+
322+
If some place in the documentation needs to typeset a command usage
323+
example with inline substitutions, it is fine to use +monospaced and
324+
inline substituted text+ instead of `monospaced literal text`, and with
325+
the former, the part that should not get substituted must be
326+
quoted/escaped.

0 commit comments

Comments
 (0)