Subject: Re: [PATCH 1/3] doc: git-rev-parse: enforce command-line description syntax

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 Feb 2024 09:31:30 -0800

Jean-Noël Avila <[email-masked]> writes:

>>> ---short[=length]::
>>> +--short[=<length>]::
>>>   	Same as `--verify` but shortens the object name to a unique
>>>   	prefix with at least `length` characters. The minimum length
>> This same comment applies throughout this patch, but in other places
>> when we use <placeholder> in the option argument description, don't
>> we use the same <placeholder> in text as well?  I am wondering if
>> the `length` (typeset in fixed-width) should become <length>.  What
>> do other recent[*] documentation pages commonly do?
>
> This is another part of the inconsistences in documentation that I'd
> like to tackle (hopefully, not in another life).
>
> Using angle brackets for placeholders everywhere they appear is a
> visual link to the preceding syntax description, but may feel a bit
> heavy on some cases. Anyway, I'm all for applying the rule everywhere,
> for the sake of consistency.

I agree that if <placeholder> is not an appropriate way to spell
them in the explanation text, we would want to change them
consistently everywhere, and until then, using the angle-bracketted
<placeholder> that is common would be better.  The text will be
modified again when we decide to switch from <placeholder> to
something else, so updating them now may be a wasted effort, but (1)
we may decide that <placeholder> is good enough after all, or (2) it
may make it easier to mechanically identify words whose mark-up
should be converted if we consistently use <placeholder> now, even
if we know it won't be the final mark-up.

So I am inclined to say that we should first do `length` -> <length>
in the body text in the short term.  But I also think we should
*not* do so as part of this patch, whose focus is how the option
enumeration header should mark up the option arguments.

> Backticks and single quotes are used indistinctively (by the way,
> asciidoctor does not process single quotes as markup) and are not used
> everywhere they should. Using backticks is also a good hint for
> translators to mean "verbatim, do not translate". Obviously, the
> placeholders ask for translation, so the backtick rule should not
> apply to them, even if another formating would be welcome :
> _<placeholder>_ for instance?

Yes.  The way AsciiDoc renders (at least HTML) an unadorned <placeholder>
is not so great.

In "git-add.html" manual page, we see these examples.  The first one
(unadorned) does not make the placeholder word stand out enough; the
second one that does `<file>` makes it stand out better, but as you
said, the `verbatim` mark-up is semantically wrong.

https://git.github.io/htmldocs/git-add.html#:~:text=For%20more%20details%20about%20the%20%3Cpathspec%3E%20syntax

https://git.github.io/htmldocs/git-add.html#:~:text=Pathspec%20is%20passed%20in%20%3Cfile%3E%20instead%20of%20commandline%20args.%20If%20%3Cfile%3E%20is%20exactly%20%2D%20then%20standard%20input%20is%20used.%20Pathspec

The last part of the Documentation/CodingGuidelines document talks
about how to mark up placeholders but it does not go beyond saying
that they are written as <hyphen-in-between-words-in-angle-braket>.
Whatever mark-up rule we decide to use, we should document it there.

Thanks.