git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 2/3] doc: update the guidelines to reflect the current formatting rules

From
Jean-Noël Avila via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 5, 2024, 21:52 UTC
Message-ID
<c48649ccd63bf8388c548f18bca545beca9bb41e.1725573126.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1766.v4.git.1725573126.gitgitgadget@gmail.com>
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
---
 Documentation/CodingGuidelines | 58 ++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index ccaea39752c..13cbcf1d7a5 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -820,78 +820,80 @@ Markup:
    _<new-branch-name>_
    _<template-directory>_
 
- A placeholder is not enclosed in backticks, as it is not a literal.
-
  When needed, use a distinctive identifier for placeholders, usually
  made of a qualification and a type:
    _<git-dir>_
    _<key-id>_
 
- When literal and placeholders are mixed, each markup is applied for
- each sub-entity. If they are stuck, a special markup, called
- unconstrained formatting is required.
- Unconstrained formating for placeholders is __<like-this>__
- Unconstrained formatting for literal formatting is ++like this++
-   `--jobs` _<n>_
-   ++--sort=++__<key>__
-   __<directory>__++/.git++
-   ++remote.++__<name>__++.mirror++
+ Git's Asciidoc processor has been tailored to treat backticked text
+ as complex synopsis. When literal and placeholders are mixed, you can
+ use the backtick notation which will take care of correctly typesetting
+ the content.
+   `--jobs <n>`
+   `--sort=<key>`
+   `<directory>/.git`
+   `remote.<name>.mirror`
+   `ssh://[<user>@]<host>[:<port>]/<path-to-git-repo>`
 
- caveat: ++ unconstrained format is not verbatim and may expand
- content. Use Asciidoc escapes inside them.
+As a side effect, backquoted placeholders are correctly typeset, but
+this style is not recommended.
 
 Synopsis Syntax
 
- Syntax grammar is formatted neither as literal nor as placeholder.
+ The synopsis (a paragraph with [synopsis] attribute) is automatically
+ formatted by the toolchain and does not need typesetting.
 
  A few commented examples follow to provide reference when writing or
  modifying command usage strings and synopsis sections in the manual
  pages:
 
  Possibility of multiple occurrences is indicated by three dots:
-   _<file>_...
+   <file>...
    (One or more of <file>.)
 
  Optional parts are enclosed in square brackets:
-   [_<file>_...]
+   [<file>...]
    (Zero or more of <file>.)
 
-   ++--exec-path++[++=++__<path>__]
+ An optional parameter needs to be typeset with unconstrained pairs
+   [<repository>]
+
+   --exec-path[=<path>]
    (Option with an optional argument.  Note that the "=" is inside the
    brackets.)
 
-   [_<patch>_...]
+   [<patch>...]
    (Zero or more of <patch>.  Note that the dots are inside, not
    outside the brackets.)
 
  Multiple alternatives are indicated with vertical bars:
-   [`-q` | `--quiet`]
-   [`--utf8` | `--no-utf8`]
+   [-q | --quiet]
+   [--utf8 | --no-utf8]
 
  Use spacing around "|" token(s), but not immediately after opening or
  before closing a [] or () pair:
-   Do: [`-q` | `--quiet`]
-   Don't: [`-q`|`--quiet`]
+   Do: [-q | --quiet]
+   Don't: [-q|--quiet]
 
  Don't use spacing around "|" tokens when they're used to separate the
  alternate arguments of an option:
-    Do: ++--track++[++=++(`direct`|`inherit`)]`
-    Don't: ++--track++[++=++(`direct` | `inherit`)]
+    Do: --track[=(direct|inherit)]
+    Don't: --track[=(direct | inherit)]
 
  Parentheses are used for grouping:
-   [(_<rev>_ | _<range>_)...]
+   [(<rev>|<range>)...]
    (Any number of either <rev> or <range>.  Parens are needed to make
    it clear that "..." pertains to both <rev> and <range>.)
 
-   [(`-p` _<parent>_)...]
+   [(-p <parent>)...]
    (Any number of option -p, each with one <parent> argument.)
 
-   `git remote set-head` _<name>_ (`-a` | `-d` | _<branch>_)
+   git remote set-head <name> (-a|-d|<branch>)
    (One and only one of "-a", "-d" or "<branch>" _must_ (no square
    brackets) be provided.)
 
  And a somewhat more contrived example:
-   `--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]`
+   --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
    Here "=" is outside the brackets, because "--diff-filter=" is a
    valid usage.  "*" has its own pair of brackets, because it can
    (optionally) be specified only when one or more of the letters is
-- 
gitgitgadget
Previous: Jean-Noël Avila via GitGitGadgetNext: Jean-Noël Avila via GitGitGadget
Message 26 of 45 in “doc: introducing synopsis para”
  1. 0/3 doc: introducing synopsis paraJean-Noël Avila via GitGitGadget, Jul 23, 2024
  2. 1/3 doc: introduce a synopsis custom paragraph attributeJean-Noël Avila via GitGitGadget, Jul 23, 2024
  3. Junio C HamanoJul 23, 2024
  4. 2/3 doc: update the guidelines to reflect the current formatting rulesJean-Noël Avila via GitGitGadget, Jul 23, 2024
  5. Junio C HamanoJul 23, 2024
  6. 3/3 doc: apply synopsis simplification on git-clone and git-initJean-Noël Avila via GitGitGadget, Jul 23, 2024
  7. Jean-Noël AVILAJul 23, 2024
  8. 0/3 doc: introducing synopsis paraJean-Noël Avila via GitGitGadget, Jul 24, 2024
  9. 1/3 doc: introduce a synopsis custom paragraph attributeJean-Noël Avila via GitGitGadget, Jul 24, 2024
  10. 2/3 doc: update the guidelines to reflect the current formatting rulesJean-Noël Avila via GitGitGadget, Jul 24, 2024
  11. 3/3 doc: apply synopsis simplification on git-clone and git-initJean-Noël Avila via GitGitGadget, Jul 24, 2024
  12. Junio C HamanoJul 24, 2024
  13. Jean-Noël AVILAJul 25, 2024
  14. Junio C HamanoJul 25, 2024
  15. 0/3 doc: introducing synopsis paraJean-Noël Avila via GitGitGadget, Aug 11, 2024
  16. 1/3 doc: introduce a synopsis custom paragraph attributeJean-Noël Avila via GitGitGadget, Aug 11, 2024
  17. 2/3 doc: update the guidelines to reflect the current formatting rulesJean-Noël Avila via GitGitGadget, Aug 11, 2024
  18. Eric SunshineAug 11, 2024
  19. Jean-Noël AvilaAug 12, 2024
  20. 3/3 doc: apply synopsis simplification on git-clone and git-initJean-Noël Avila via GitGitGadget, Aug 11, 2024
  21. Junio C HamanoAug 19, 2024
  22. Jean-Noël AVILAAug 21, 2024
  23. Junio C HamanoAug 30, 2024
  24. 0/3 doc: introducing synopsis paraJean-Noël Avila via GitGitGadget, Sep 5, 2024
  25. 1/3 doc: introduce a synopsis typesettingJean-Noël Avila via GitGitGadget, Sep 5, 2024
  26. 2/3 doc: update the guidelines to reflect the current formatting rulesJean-Noël Avila via GitGitGadget, Sep 5, 2024
  27. 3/3 doc: apply synopsis simplification on git-clone and git-initJean-Noël Avila via GitGitGadget, Sep 5, 2024
  28. Junio C HamanoSep 13, 2024
  29. Josh SteadmonSep 20, 2024
  30. Junio C HamanoSep 21, 2024
  31. Junio C HamanoSep 21, 2024
  32. Junio C HamanoSep 21, 2024
  33. Chris TorekSep 21, 2024
  34. Junio C HamanoSep 23, 2024
  35. 0/3 doc: introducing synopsis paraJean-Noël Avila via GitGitGadget, Sep 24, 2024
  36. 1/3 doc: introduce a synopsis typesettingJean-Noël Avila via GitGitGadget, Sep 24, 2024
  37. 2/3 doc: update the guidelines to reflect the current formatting rulesJean-Noël Avila via GitGitGadget, Sep 24, 2024
  38. 3/3 doc: apply synopsis simplification on git-clone and git-initJean-Noël Avila via GitGitGadget, Sep 24, 2024
  39. Junio C HamanoSep 24, 2024
  40. Torsten BögershausenSep 24, 2024
  41. Junio C HamanoSep 24, 2024
  42. Josh SteadmonOct 2, 2024
  43. Junio C HamanoOct 2, 2024
  44. Josh SteadmonSep 24, 2024
  45. Junio C HamanoSep 24, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.