{Docs} Quote code in help messages with backticks#13060
Conversation
| c.argument('network_acls', type=validate_file_or_dict, | ||
| help='Network ACLs. It accepts a JSON filename or a JSON string. JSON format: ' | ||
| '{\\"ip\\":[<ip1>, <ip2>...],\\"vnet\\":[<vnet_name_1>/<subnet_name_1>,<subnet_id2>...]}') | ||
| '`{\\"ip\\":[<ip1>, <ip2>...],\\"vnet\\":[<vnet_name_1>/<subnet_name_1>,<subnet_id2>...]}`') |
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks for pointing it out.
| with self.argument_context('managedapp definition create') as c: | ||
| c.argument('lock_level', arg_type=get_enum_type(ApplicationLockLevel), help='The type of lock restriction.') | ||
| c.argument('authorizations', options_list=['--authorizations', '-a'], nargs='+', help="space-separated authorization pairs in a format of <principalId>:<roleDefinitionId>") | ||
| c.argument('authorizations', options_list=['--authorizations', '-a'], nargs='+', help="space-separated authorization pairs in a format of `<principalId>:<roleDefinitionId>`") |
There was a problem hiding this comment.
| with self.argument_context('network public-ip prefix') as c: | ||
| c.argument('public_ip_prefix_name', name_arg_type, completer=get_resource_name_completion_list('Microsoft.Network/publicIPPrefixes'), id_part='name', help='The name of the public IP prefix.') | ||
| c.argument('prefix_length', options_list='--length', help='Length of the prefix (i.e. XX.XX.XX.XX/<Length>)') | ||
| c.argument('prefix_length', options_list='--length', help='Length of the prefix (i.e. `XX.XX.XX.XX/<Length>`)') |
There was a problem hiding this comment.
| with self.argument_context('vmss create', min_api='2017-03-30', arg_group='Network') as c: | ||
| c.argument('public_ip_per_vm', action='store_true', help="Each VM instance will have a public ip. For security, you can use '--nsg' to apply appropriate rules") | ||
| c.argument('vm_domain_name', help="domain name of VM instances, once configured, the FQDN is 'vm<vm-index>.<vm-domain-name>.<..rest..>'") | ||
| c.argument('vm_domain_name', help="domain name of VM instances, once configured, the FQDN is `vm<vm-index>.<vm-domain-name>.<..rest..>`") |
There was a problem hiding this comment.
There was a problem hiding this comment.
How do you send picture?
Create a screenshot and paste it into input box? I guess.
This is the way I used.
|
How do you preview the rendered html page to see the result is expected? |
I don't know how to "preview the rendered html page". I am deducing it from the global params
|
|
I encounter a same issue of a new parameter I add in Azure CLI 2.4.0. Only at release time can I see the HTML page. This is the problem! |
|
add to S169 |
fengzhou-msft
left a comment
There was a problem hiding this comment.
Can we put a guidance in authoring_help.md?
| - Don't use "etc". Sometimes it makes sense to spell out a list completely. Sometimes it works to say "like ..." instead of "..., etc". | ||
| - Use active voice. For example, say "Update web app configurations" instead of "Updates web app congfigurations" or "Updating web app configurations". | ||
| - Don't use highly formal language. If you imagine that another dev sat down with you and you were telling him what he needs to know to use the command, that's exactly what you need to write, in those words. | ||
| - If the help message contains **angle brackets**, like `<name>`, it will be parsed as an HTML tag during document rendering. To bypass that, quote the content with backticks `` `<name>` `` to tell the document renderer to parse it as **code**. |
There was a problem hiding this comment.
Can we put a guidance in authoring_help.md?
Good point, added.
doc/authoring_help.md
Outdated
|
|
||
|
|
||
| ### Example YAML help file, _help.py ### | ||
| ### Example YAML help file, _help.py |






Description
Fix #10698:
az ad app permission adddescription not understandableSymptom
The doc for
az ad app permission addis not rendered correctly, with the value of--api-permissionsmissing.https://docs.microsoft.com/en-us/cli/azure/ad/app/permission
Root Cause
The reason is that the doc generator parses
<resource-access-id>and<type>as a possible HTML entities:azure-cli/src/azure-cli/azure/cli/command_modules/role/_params.py
Line 61 in 1f34245
but they don't match up with any entities on the Docs HTML Whitelist, and the content is discarded.
This happens not only to this command but all over the place, including VM, Network and more commands.
Solution
This PR quotes the text with backticks
`like whatazure-cli-coredoes for--resource-group:azure-cli/src/azure-cli-core/azure/cli/core/commands/parameters.py
Line 241 in c4e91c0
In this way, the doc is rendered correctly (even better with highlighting due to backtick (
`) being interpreted ascodein markdown), such ashttps://docs.microsoft.com/en-us/cli/azure/acs
⚠ But the disadvantage is the
--helpmessage may look verbose.Remarks
I searched the occurrence of
<>with regex<.+?>(?stands for non-greedy match) and added backticks manually.