Subject: Re: [PATCH v3 7/9] doc: git-log: convert pretty formats to new doc format

From: SZEDER Gábor <[email-masked]>
Date: Sun, 17 Aug 2025 23:29:23 +0200

On Mon, Jul 07, 2025 at 06:53:30PM +0000, Jean-Noël Avila via GitGitGadget wrote:
> From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email-masked]>
> 
> - Use _<placeholder>_ instead of <placeholder> in the description
> - Use `backticks` for keywords and more complex option
> descriptions. The new rendering engine will apply synopsis rules to
> these spans.
> 
> For all the formats in the form of %(foo), the formatting needs to be
> heavier because we not want the parentheses to be rendered as syntax
> elements,but as keywords, i.e. we need to circumvent the syntax highlighting
> of synopsis.  In this particular case, this requires the heavy escaping of
> the parts that contain parentheses with ++.
> 
> Signed-off-by: Jean-Noël Avila <[email-masked]>
> ---
>  Documentation/pretty-formats.adoc | 283 +++++++++++++++---------------
>  1 file changed, 143 insertions(+), 140 deletions(-)
> 
> diff --git a/Documentation/pretty-formats.adoc b/Documentation/pretty-formats.adoc
> index 07475de8c337..9ed0417fc811 100644
> --- a/Documentation/pretty-formats.adoc
> +++ b/Documentation/pretty-formats.adoc

> +++%(decorate++`[:<option>,...]`++)++::
>  ref names with custom decorations. The `decorate` string may be followed by a
>  colon and zero or more comma-separated options. Option values may contain
>  literal formatting codes. These must be used for commas (`%x2C`) and closing
>  parentheses (`%x29`), due to their role in the option syntax.
>  +
> -** 'prefix=<value>': Shown before the list of ref names.  Defaults to "{nbsp}`(`".
> -** 'suffix=<value>': Shown after the list of ref names.  Defaults to "`)`".
> -** 'separator=<value>': Shown between ref names.  Defaults to "`,`{nbsp}".
> -** 'pointer=<value>': Shown between HEAD and the branch it points to, if any.
> -		      Defaults to "{nbsp}`->`{nbsp}".
> -** 'tag=<value>': Shown before tag names. Defaults to "`tag:`{nbsp}".
> +** `prefix=<value>`: Shown before the list of ref names.  Defaults to "{nbsp}+(+".
> +** `suffix=<value>`: Shown after the list of ref names.  Defaults to "+)+".
> +** `separator=<value>`: Shown between ref names.  Defaults to "+,+{nbsp}".
> +** `pointer=<value>`: Shown between HEAD and the branch it points to, if any.
> +		      Defaults to "{nbsp}+->+{nbsp}".
> +** `tag=<value>`: Shown before tag names. Defaults to "`tag:`{nbsp}".
>  
>  +
>  For example, to produce decorations with no wrapping
>  or tag annotations, and spaces as separators:
>  +
> -`%(decorate:prefix=,suffix=,tag=,separator= )`
> +++%(decorate:prefix=,suffix=,tag=,separator= )++

This section now looks like this when the man page is built with
Asciidoctor:

               %(decorate[:<option>,...])
                   ref names with custom decorations. The decorate string may
                   be followed by a colon and zero or more comma-separated
                   options. Option values may contain literal formatting
                   codes. These must be used for commas (%x2C) and closing
                   parentheses (%x29), due to their role in the option syntax.
                   parentheses (%x29), due to their role in the option syntax.

                   •   prefix=<value>: Shown before the list of ref names.
                       Defaults to " +(+".

                   •   suffix=<value>: Shown after the list of ref names.
                       Defaults to ")".

                   •   separator=<value>: Shown between ref names. Defaults to
                       ", ".

                   •   pointer=<value>: Shown between HEAD and the branch it
                       points to, if any. Defaults to " +→+ ".

                   •   tag=<value>: Shown before tag names. Defaults to
                       "tag: ".

           For example, to produce decorations with no wrapping or tag
           annotations, and spaces as separators:

           + %(decorate:prefix=,suffix=,tag=,separator= )

Note the unnecessary + characters in the default values for 'prefix'
and 'pointer', and in the latter the "ASCII art" arrow ("->") is now
replaced with a unicode arrow character.

Also note that the last three lines are not aligned properly and the
example format string starts with a + character as well, but this was
the case even before this patch.

I use the distro packaged version of Asciidoctor:

  $ asciidoctor --version
  Asciidoctor 2.0.16 [https://asciidoctor.org]
  Runtime Environment (ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)