style-guide: organize content and update sections; *: fix Markdownlint errors (#12148)

* style-guide: organize content and add contents section

* style-guide: fix general writing section title

* style-guide: fix heading level of help and version commands

* style-guide: fix heading level of see also section

* cleanup: update files

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* contributing: fix page for markdown lint

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* fix: markdownlint errors across files

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* docs: improve documentation about keycaps

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* docs: add info about optional and string placeholders

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* cleanup: sync changes with recent versions of style guide

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* cleanup: update style guide

Co-authored-by: Vítor Henrique <87824454+vitorhcl@users.noreply.github.com>

* docs: update style guide

Co-authored-by: Vítor Henrique <87824454+vitorhcl@users.noreply.github.com>

* docs/style-guide: reword more info links section

Co-authored-by: Vítor Henrique <87824454+vitorhcl@users.noreply.github.com>

---------

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
pull/28/head
Vítor Henrique 2024-04-22 00:50:17 -03:00 committed by GitHub
parent ff25dcff9a
commit 5e6dc70b2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 261 additions and 184 deletions

View File

@ -3,6 +3,7 @@
"MD003": { "style": "atx" },
"MD007": { "indent": 4 },
"MD013": { "line_length": 250 },
"MD029": false,
"MD033": false,
"MD034": false,
"no-hard-tabs": false,

View File

@ -1,3 +1,4 @@
<!-- markdownlint-disable MD007 MD013 MD024-->
# tldr-pages client specification
**Current Specification Version:** 2.2
@ -112,7 +113,7 @@ The structure inside these translation folders is identical to that of the main
## Page structure
Although this specification is about the interface that clients must provide, it is also worth noting that pages are written in standard [CommonMark](https://commonmark.org/), with the exception of the non-standard `{{` and `}}` placeholder syntax, which surrounds values in an example that users may edit. Clients MAY highlight the placeholders and MUST remove the surrounding curly braces. Clients MUST NOT treat them as the placeholder syntax if they are escaped using `\` (i.e. `\{\{` and `\}\}`) and MUST instead display literal braces, without backslashes. Placeholder escaping applies only when both braces are escaped (e.g. in `\{` or `\{{`, backslashes MUST be displayed). In cases when a command uses `{}` in its arguments (e.g. `stash@{0}`) ***the outer braces*** mark the placeholder - the braces inside MUST be displayed. Clients MUST NOT break if the page format is changed within the _CommonMark_ specification.
Although this specification is about the interface that clients must provide, it is also worth noting that pages are written in standard [CommonMark](https://commonmark.org/), with the exception of the non-standard `{{` and `}}` placeholder syntax, which surrounds values in an example that users may edit. Clients MAY highlight the placeholders and MUST remove the surrounding curly braces. Clients MUST NOT treat them as the placeholder syntax if they are escaped using `\` (i.e. `\{\{` and `\}\}`) and MUST instead display literal braces, without backslashes. Placeholder escaping applies only when both braces are escaped (e.g. in `\{` or `\{{`, backslashes MUST be displayed). In cases when a command uses `{}` in its arguments (e.g. `stash@{0}`) **_the outer braces_** mark the placeholder - the braces inside MUST be displayed. Clients MUST NOT break if the page format is changed within the _CommonMark_ specification.
### Examples

View File

@ -220,7 +220,9 @@ can then perform the actual role changes.
## CODEOWNERS
The [`.github/CODEOWNERS` file](https://github.com/tldr-pages/tldr/blob/main/.github/CODEOWNERS) allows contributors with write access to the [tldr-pages/tldr repository](https://github.com/tldr-pages/tldr) to get automatic review request notifications for given files and directories.
The [`.github/CODEOWNERS` file](https://github.com/tldr-pages/tldr/blob/main/.github/CODEOWNERS) allows contributors with write access to the [tldr-pages/tldr repository](https://github.com/tldr-pages/tldr)
to get automatic review request notifications for given files and directories.
If they wish to, contributors can open a pull request to add themselves to this file as desired.
Example uses include (but are not limited to):

View File

@ -21,6 +21,10 @@ Contributions to the tldr-pages project are [most welcome](GOVERNANCE.md)!
All `tldr` pages are stored in Markdown right here on GitHub. Just open an issue or send a pull request, and we'll incorporate it as soon as possible.
> [!IMPORTANT]
> While this file contains general instructions to get started, it is suggested to read the [style guide](contributing-guides/style-guide.md) and [translation templates](contributing-guides/translation-templates)
> for more detailed information about the syntax and commonly used translation terms.
To get started, please [sign](https://cla-assistant.io/tldr-pages/tldr) the
[Contributor License Agreement](https://gist.github.com/waldyrious/e50feec13683e565769fbd58ce503d4e).
@ -50,12 +54,14 @@ When in doubt, have a look at a few existing pages :).
## Directory structure
The English pages directory is called `pages`, under which the platform directories are present. Language-specific directories must follow the pattern `pages.<locale>`, where `<locale>` is a [POSIX Locale Name](https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html#Locale-Names) in the form of `<language>[_<country>]`, where:
The English pages directory is called `pages`, under which the platform directories are present. Language-specific directories must follow the pattern `pages.<locale>`, where `<locale>` is a
[POSIX Locale Name](https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html#Locale-Names) in the form of `<language>[_<country>]`, where:
- `<language>` is the shortest [ISO 639](https://en.wikipedia.org/wiki/ISO_639) language code for the chosen language (see [here](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes) for a complete list).
- `<country>` is the two-letter [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code for the chosen region (see [here](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) for a complete list).
The `<country>` code is optional and should only be added when there is a substantial difference between a language (`ll`) and its regional dialects (`ll_CC1`, `ll_CC2`, etc.). For example, both `fr_FR` and `fr_BE` should fall under the same `pages.fr` directory since there virtually is no difference in writing between standard French and Belgian French.
The `<country>` code is optional and should only be added when there is a substantial difference between a language (`ll`) and its regional dialects (`ll_CC1`, `ll_CC2`, etc.).
For example, both `fr_FR` and `fr_BE` should fall under the same `pages.fr` directory since there virtually is no difference in writing between standard French and Belgian French.
### Platform directories
@ -63,14 +69,15 @@ The `pages` directory and `pages.*` language-specific directories contain the pl
1. If the command is available for **two or more** platforms, put it **under the `common` directory**.
2. If the command is **only** available for **one** platform, these are the available directories followed by their right platform:
- `android`: Android
- `freebsd`: FreeBSD
- `openbsd`: OpenBSD
- `osx`: OSX/Mac OS/macOS (will be replaced by `macos`)
- `linux`: any Linux distro
- `netbsd`: NetBSD
- `sunos`: SunOS
- `windows`: Windows
- `android`: Android
- `freebsd`: FreeBSD
- `openbsd`: OpenBSD
- `osx`: OSX/Mac OS/macOS (will be replaced by `macos`)
- `linux`: any Linux distro
- `netbsd`: NetBSD
- `sunos`: SunOS
- `windows`: Windows
## Markdown format
@ -167,7 +174,7 @@ See these examples for reference:
> [!IMPORTANT]
> Translations of pages should be done based on the English (US) page in the `pages` directory. If the English pages don't exist for the command, it should be added first in a PR before creating a translation.
Translation of pages can be done by simply creating the corresponding page within the appropriate [language-specific directory](#pages-directory), creating that as well if it does not already exist.
Translation of pages can be done by simply creating the corresponding page within the appropriate [language-specific directory](#directory-structure), creating that as well if it does not already exist.
> [!IMPORTANT]
> When adding a new language to `tldr`, it is suggested to add it to the [translation templates](contributing-guides/translation-templates) along with any page additions.
@ -216,7 +223,8 @@ tldr-lint {{path/to/page.md}}
Now, you are ready to submit a pull request!
> [!TIP]
> Additionally, inside the `tldr` directory you can install the dependencies using the `npm install` command and now when you commit your changes, the tests will run automatically via the pre-commit hook. (To skip the pre-commit hook and immediately commit your changes use the `git commit --no-verify` command).
> Additionally, inside the `tldr` directory you can install the dependencies using the `npm install` command and now when you commit your changes, the tests will run automatically via the pre-commit hook.
> (To skip the pre-commit hook and immediately commit your changes use the `git commit --no-verify` command).
### Submitting changes
@ -229,11 +237,13 @@ Alternatively, you can do most of the process
[using Git on the command-line](contributing-guides/git-terminal.md).
> [!TIP]
> After creating a pull request, it is suggested to enable the "Allow edits by maintainers" option (This only needs to be done once the first time you create a PR). It allows maintainers to make changes to your pull request and assist you in getting it merged.
> After creating a pull request, it is suggested to enable the "Allow edits by maintainers" option (This only needs to be done once the first time you create a PR).
> It allows maintainers to make changes to your pull request and assist you in getting it merged, in addition to facilitate the contribution to go on if you can no longer work on it soon for any reason.
### Accepting suggestions within a pull request
The easiest way to apply suggested changes is to accept the suggestion made on your pull request. Refer to the [GitHub docs](https://docs.github.com/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request) for more details.
The easiest way to apply suggested changes is to accept the suggestion made on your pull request.
Refer to the [GitHub docs](https://docs.github.com/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request) for more details.
To commit a suggestion to your pull request, click on `Commit suggestion`:
@ -268,7 +278,8 @@ For other cases, it is suggested to follow <https://www.conventionalcommits.org/
## Name collisions
When there are multiple commands sharing the same name, the existing page of the command and the new command can be renamed to `command.1` and so on following a numbering scheme or based on the programming language i.e. `command.js`. The base page can be updated to reference the newly renamed/created pages by following [this subcommand reference format](#subcommands).
When there are multiple commands sharing the same name, the existing page of the command and the new command can be renamed to `command.1` and so on following a numbering scheme or based on the programming language i.e. `command.js`.
The base page can be updated to reference the newly renamed/created pages by following [this subcommand reference format](#subcommands).
See the following page for reference:

View File

@ -1,3 +1,4 @@
<!-- markdownlint-disable MD041 -->
Copyright © 2014—present the [tldr-pages team](https://github.com/orgs/tldr-pages/people)
and [contributors](https://github.com/tldr-pages/tldr/graphs/contributors).

View File

@ -6,7 +6,8 @@ This file contains a list of the maintainers of the tldr-pages project.
> Only the people marked with **bold** are currently in the indicated role.
> The other entries are kept for historical record.
There are three types of maintainers, as described in [COMMUNITY-ROLES.md](https://github.com/tldr-pages/tldr/blob/main/COMMUNITY-ROLES.md#when-to-change-roles): repository collaborators, organization members, and organization owners — each having specific roles in maintaining the project, as outlined below.
There are three types of maintainers, as described in [COMMUNITY-ROLES.md](https://github.com/tldr-pages/tldr/blob/main/COMMUNITY-ROLES.md#when-to-change-roles): repository collaborators, organization members,
and organization owners — each having specific roles in maintaining the project, as outlined below.
In general terms, all maintainers are expected to follow the [Maintainer's guide](contributing-guides/maintainers-guide.md).

View File

@ -1,3 +1,4 @@
<!-- markdownlint-disable MD041 -->
<div align="center">
<h1><a href="https://tldr.sh/"><img alt="tldr-pages" src="images/banner.png" width=600/></a></h1>
@ -67,7 +68,8 @@ Alternatively, you can also use the official [Python client](https://github.com/
pip3 install tldr
```
Linux and Mac users can also install the official [Rust Client](https://github.com/tldr-pages/tlrc) using [Homebrew](https://formulae.brew.sh/formula/tlrc) (or [other package managers](https://github.com/tldr-pages/tlrc#installation) on other operating systems):
Linux and Mac users can also install the official [Rust Client](https://github.com/tldr-pages/tlrc) using [Homebrew](https://formulae.brew.sh/formula/tlrc)
(or [other package managers](https://github.com/tldr-pages/tlrc#installation) on other operating systems):
```shell
brew install tlrc

View File

@ -1,4 +1,5 @@
# Using Git
## Opening a Pull Request
Most people submit pull requests to the tldr-pages project
@ -61,6 +62,7 @@ git fetch upstream main
git rebase upstream/main # in case you have any merge conflicts, click the link below to see how to resolve them
git push --force-with-lease # not needed if you only want to update your local repository
```
[How to resolve merge conflicts](https://docs.github.com/en/github/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line)
## Changing the email of your last commit
@ -74,15 +76,18 @@ git push --force-with-lease
## Changing the email of any commit(s)
1. Perform an [interactive rebase](https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt--i), specifying the reference of the earliest commit to modify as the argument. For example, if the earliest commit with the wrong email address was 6 commits ago, you can specify the commit hash or just `HEAD~6`.
1. Perform an [interactive rebase](https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt--i), specifying the reference of the earliest commit to modify as the argument.
For example, if the earliest commit with the wrong email address was 6 commits ago, you can specify the commit hash (check it with `git log`) or just `HEAD~6`.
```bash
git rebase --interactive HEAD~6
```
2. You'll see a list of commits starting from the referenced commit to `HEAD`. All of them will default to the instruction `pick`, this means using the commit as-is when replaying them. For the commits you want to edit, replace the word `pick` with `edit`, then save and exit the editor.
2. You'll see a list of commits starting from the referenced commit to `HEAD`. All of them will default to the instruction `pick`, this means using the commit as-is when replaying them.
For the commits you want to edit, replace the word `pick` with `edit`, then save and exit the editor.
3. The branch will rewind to the referenced commit, then replay them until it reaches a commit with the `edit` instruction. Amend the commit for the correct email address, then continue rebasing. Repeat this step until you've successfully finished rebasing and replayed all commits.
3. The branch will rewind to the referenced commit, then replay them until it reaches a commit with the `edit` instruction. Amend the commit for the correct email address, then continue rebasing.
Repeat this step until you've successfully finished rebasing and replayed all commits.
```bash
git commit --amend --author "Your Name <correct@example.org>"

View File

@ -2,7 +2,17 @@
This page lists specific formatting instructions for `tldr` pages.
## Layout
## Contents
1. [General layout](#general-layout)
2. [Pages](#pages)
3. [General writing](#general-writing)
4. [Heading](#heading)
5. [Example descriptions](#example-descriptions)
6. [Example commands](#example-commands)
7. [Language-specific rules](#language-specific-rules)
## General layout
The basic format of each page should match the following template and have at most 8 command examples:
@ -66,10 +76,10 @@ npm install --global tldr-lint
tldr-lint path/to/tldr_page.md
```
For other ways to use `tldr-lint`, such as linting an entire directory, check out (what else!)
[`tldr tldr-lint`](https://github.com/tldr-pages/tldr/blob/main/pages/common/tldr-lint.md). Alternatively, you can also use its alias `tldrl`.
For other ways to use `tldr-lint`, such as linting an entire directory, check out the
[`tldr page on tldr-lint`](https://github.com/tldr-pages/tldr/blob/main/pages/common/tldr-lint.md). Alternatively, you can also use its alias `tldrl`.
Your client may be able to preview a page locally using the `--render` flag:
Depending on your client, you may be able to preview a page locally using the `--render` flag:
```sh
tldr --render path/to/tldr_page.md
@ -83,7 +93,11 @@ When documenting PowerShell commands, please take note of the following naming c
- The page title/heading must be written as-is (matching the spelling intended by Microsoft or the PowerShell module author), such as `Invoke-WebRequest` instead of `invoke-webrequest`.
- The command name and options in the examples should also be written as-is, such as `Command-Name {{input}} -CommandParameter {{value}}` instead of `command-name {{input}} -commandparameter {{value}}`.
Due to [various compatibility differences](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell) and removed Windows-specific commands in PowerShell 6.x, Ensure that the command works on between **PowerShell 5.1** (aka. the "Legacy Windows PowerShell" as installed in Windows 10 and 11), and the **latest version of the Cross-Platform PowerShell** (formerly known as PowerShell Core). If the command or its options is unavailable or contains different behavior between each version, please kindly note them in the descriptions. For example,
Due to [various compatibility differences](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell) and removed Windows-specific commands in PowerShell 6.x, ensure that
the command works on between **PowerShell 5.1** (aka. the "Legacy Windows PowerShell" as installed in Windows 10
and 11), and the **latest version of the Cross-Platform PowerShell** (formerly known as PowerShell Core).
Thus, if the command or its options is unavailable or contains different behavior between each version, please kindly note them in the descriptions. For example:
```md
# Clear-RecycleBin
@ -93,7 +107,17 @@ Due to [various compatibility differences](https://learn.microsoft.com/powershel
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/clear-recyclebin>.
```
## Aliases
## Pages
### Platform differences
If you are afraid the commands may differ between platforms or operating systems (e.g. Windows vs macOS),
most [tldr pages clients](https://github.com/tldr-pages/tldr/wiki/tldr-pages-clients) will choose the most suitable version of the command to be displayed to the enduser.
In this case, the information of the Windows version of `cd` (stored in `pages/windows/cd.md`) will be displayed by default to Windows users, and a generic/common version (stored in `pages/common/cd.md`)
will be displayed for Linux, macOS, and other platform users.
### Aliases
If a command can be called with alternative names (like `vim` can be called by `vi`), alias pages can be created to point the user to the original command name.
@ -123,11 +147,12 @@ Example:
- Pre-translated alias page templates can be found [here](https://github.com/tldr-pages/tldr/blob/main/contributing-guides/translation-templates/alias-pages.md).
### PowerShell-Specific Aliases
#### PowerShell-Specific Aliases
Some PowerShell commands may introduce aliases which fall into one of these three categories:
**1. Substituting an existing Windows Command Prompt (`cmd`) command**, such as `cd` aliasing to `Set-Location` with different command options. In this case, add the following alias note into the second line of the original Command Prompt command's tldr description, for example:
1. **Replaces an existing Windows Command Prompt (`cmd`) command**, such as `cd` aliasing to `Set-Location` with different command options. In this case, add the following alias note into the second line of the original
Command Prompt command's tldr description, for example:
```md
# cd
@ -141,10 +166,11 @@ Some PowerShell commands may introduce aliases which fall into one of these thre
`tldr set-location`
```
> [!TIP]
> The "View documentation of the equivalent PowerShell command" example is optional and may be excluded if the page already has the maximum number (8) of examples.
> [!NOTE]
> The "View documentation of the equivalent PowerShell command" example is optional and must be excluded if the page already has the maximum number (8) of examples.
**2. Provides a new alias but only executable in PowerShell**, such as `ni` for `New-Item`. In this case, use the [standard alias template](https://github.com/tldr-pages/tldr/blob/main/contributing-guides/translation-templates/alias-pages.md), but add the word "In Powershell," (or equivalent) to indicate that the command is exclusive to PowerShell. For example,
2. **Provides a new alias but only executable in PowerShell**, such as `ni` for `New-Item`. In this case, use the [standard alias template](https://github.com/tldr-pages/tldr/blob/main/contributing-guides/translation-templates/alias-pages.md),
but add the word "In Powershell," (or equivalent) to indicate that the command is exclusive to PowerShell. For example,
```md
# ni
@ -157,7 +183,8 @@ Some PowerShell commands may introduce aliases which fall into one of these thre
`tldr new-item`
```
**3. Provides a new alias that conflicts with other programs**, most notoriously the inclusion of `curl` and `wget` as aliases of `Invoke-WebRequest` (with a non-compatible set of command options). Note that PowerShell system aliases that fall into this category are commonly exclusive to Windows.
**3. Provides a new alias that conflicts with other programs**, most notoriously the inclusion of `curl` and `wget` as aliases of `Invoke-WebRequest` (with a non-compatible set of command options).
Note that PowerShell system aliases that fall into this category are commonly exclusive to Windows.
In this case, provide a note and method to determine whether the command currently refers to a PowerShell command (by alias) or others. For example,
@ -180,92 +207,49 @@ In this case, provide a note and method to determine whether the command current
`tldr invoke-webrequest`
```
## Option syntax
## General writing
- For commonly/frequently used commands (e.g. `grep`, `tar`, `etc`), we prefer using short options along with [mnemonics](#short-option-mnemonics) or both inside a placeholder.
- For highlighting both long and short options in commands (instead of using mnemonics), combine them within a placeholder i.e. `{{-o|--output}}`.
- For user-friendliness, use **GNU-style long options** (like `--help` rather than `-h`) when they are cross-platform compatible (intended to work the same across multiple platforms) for pages in `common` directory.
- When documenting PowerShell commands, use **PowerShell-style long options** (like `-Help` instead of `-H`).
- We prefer using a space instead of the equals sign (`=`) to separate options from their arguments (i.e. use `--opt arg` instead of `--opt=arg`) unless the program does not support it.
### Emphasis
### Short option mnemonics
Do not use *italics*, **boldface** or any other text styling on the pages. These are reserved for client emphasis of placeholders.
Short option mnemonics are optional hints which can be added to help users understand the meaning of these short options. The assigned mnemonics should match with the ones in the command's official documentation (e.g. from `man` or `Get-Help`). For example:
### Imperative Mood
- **All descriptions must be phrased in the imperative mood.**
- This also applies to all translations by default unless otherwise specified in the language-specific section below.
When writing descriptions for command examples, **check for any grammatical errors**. `Go to the specified directory` is preferred instead of:
- `Going to the specified directory` (should not be in present participle form)
- `This command will go to the specified directory` (it is clear that this example works for *this* comment)
- `Let's go to the specified directory!`
- `Directory change` (use the active form instead of passive, if possible)
For instance, instead of `Listing all files:`, `List all files:` can be used as the example's description below:
```md
- [d]isplay the ins[t]allation [i]D for the current device. Useful for offline license activation:
- Listing all files:
`slmgr.vbs /dti`
- Display the current license's e[xp]i[r]ation date and time:
`slmgr.vbs /xpr`
`ls`
```
Note that, in the first example, the `[d]`, `[t]`, and `[i]` characters are enclosed with square brackets to indicate that the `/dti` option of the command is a combination of "display", "installation", and "ID", respectively. Consecutive mnemonic characters can be grouped under the same square brackets, such as `e[xp]i[r]ation` instead of `e[x][p]i[r]ation`.
### Serial Comma
**Mnemonic characters must be written in a case-sensitive manner**, even when it is placed as the first character of the sentence (i.e. use `[d]isplay` instead of `[D]isplay`). This is to avoid conflicts with GNU-style command options which may interpret uppercase options differently than the lowercase ones, such as `-v` for displaying the command's `[v]ersion` number and `-V` to run the command in `[V]erbose` mode.
- When declaring a list of 3 or more items,
use a [serial comma](https://en.wikipedia.org/wiki/Serial_comma),
also known as the Oxford comma,
since omitting it can create ambiguity.
Option mnemonics may also be used in translations as long as the highlighted word contains similar meanings to the language (commonly English) which the command is written for. For example, `[d]ownload` in English may be translated into `[d]escargar` in Spanish, `[i]nstall` in English may be translated to `[i]nstallieren` in German, and `[a]pp` in English may be translated into `[a]plikasi` in Indonesian and Malay.
> Delete the Git branches, tags and remotes.
- Optionally, mnemonics and their enclosed terms can be separated with brackets from the rest of the description (i.e. `([a]ll)`) in translations and specific pages to provide additional context or mention a word not present in the description.
The example above does not use a serial comma, so this could mean one of two things:
> [!NOTE]
> In cases where the character isn't present in the translated word, you can highlight the option before/next to the equivalent word or you can add the English work beside the translation inside a bracket. For example, `E[x]tract` in English maybe translated into `[x] ekstrak` or `ekstrak [x]` or `ekstrak (E[x]tract)` in Indonesian.
- Delete the Git branches named `tags` and `remotes`.
- Delete all of the following: Git branches, Git tags, and Git remotes.
## Placeholder syntax
This can be resolved by inserting a comma before the "and" or "or" in the final element in the list.
User-provided values should use the `{{placeholder}}` syntax
in order to allow `tldr` clients to highlight them.
Keep the following guidelines in mind when choosing placeholders:
### Naming
- Use short but descriptive placeholders,
such as `{{path/to/source_file}}` or `{{path/to/wallet.txt}}`.
- Use [`snake_case`](https://wikipedia.org/wiki/snake_case) for multi-word placeholders.
- Use a generic placeholder rather than an actual value where a generic placeholder is available (but there is an exception to this listed below). For example, use
`iostat {{1..infinity}}` rather than `iostat {{2}}`.
- If there are several consecutive placeholders of the same type
which don't allow adding arbitrary text in them (ranges), then instead of generic placeholders use descriptive ones. For example prefer `input swipe {{x_position}} {{y_position}} {{x_position}} {{y_position}} {{seconds}}`
instead of `input swipe {{-infinity..infinity}} {{-infinity..infinity}} {{-infinity..infinity}} {{-infinity..infinity}} {{1..infinity}}`.
### Paths
- Use `{{filename}}` when just the file name is expected.
- For any reference to paths of files or directories,
use the format `{{path/to/<placeholder>}}`,
except when the location is implicit.
- When the path cannot be relative,
but has to start at the root of the filesystem,
prefix it with a slash,
such as `get {{/path/to/remote_file}}`.
- In case of a possible reference both to a file or a directory,
use `{{path/to/file_or_directory}}`.
> [!NOTE]
> If the command is specific to Windows, use backslashes (`\`) instead, such as `{{path\to\file_or_directory}}`. Drive letters such as `C:` are optional unless the command input requires an absolute path or specific drive letter range, such as `cd /d {{C}}:{{path\to\directory}}`.
### Extensions
- If a particular extension is expected for the file, append it.
For example, `unrar x {{path/to/compressed.rar}}`.
- In case a generic extension is needed, use `{{.ext}}`, but **only** if an extension is required.
For instance, in `find.md`'s example "Find files by extension" (`find {{path/to/root}} -name '{{*.ext}}'`)
using `{{*.ext}}` explains the command without being unnecessarily specific;
while in `wc -l {{path/to/file}}` using `{{path/to/file}}` (without extension) is sufficient.
### Grouping placeholders
- If a command can take 0 or more arguments of the same kind, use an ellipsis: `{{placeholder1 placeholder2 ...}}`.
For instance, if multiple paths are expected `{{path/to/directory1 path/to/directory2 ...}}` can be used.
- If a command can take 0 or more arguments of different kinds, use an ellipsis: `{{placeholder1|placeholder2|...}}`.
If there are more than 5 possible values, you can use `|...` after the last item.
- It's impossible to restrict the minimum or (and) maximum placeholder count via `ellipsis`.
It's up to the program to decide how to handle duplicating values, provided syntax
tells no info about whether items are mutually exclusive or not.
> Delete the Git branches, tags, andBrand and project names can be capitalized in the description whenever applicable (e.g. use `A tool for interacting with a Git repository.` instead of ``A tool for interacting with a `git` repository.``). remotes.
### Special cases
@ -287,78 +271,44 @@ Use backticks on the following:
- Standard streams: `stdout`, `stdin`, `stderr`. **Do not** use the full names (e.g. standard output).
- Compression algorithms, e.g. `zip`, `7z`, `xz`.
## Descriptions
## Heading
### Imperative Mood
### More information links
- **All descriptions must be phrased in the imperative mood.**
- This also applies to all translations by default unless otherwise specified in the language-specific section below.
- On the `More information` link line, we prefer linking to the author's provided documentation of the command line reference or the man page. When not available, use <https://manned.org> as the default fallback for all platforms
(except `osx` and BSD platforms other than FreeBSD).
Alternatively, you can link to the author's website or a tutorial page if the command doesn't have a documentation page.
If you are afraid the commands may differ between platforms or operating systems (e.g. Windows vs macOS), most [tldr pages clients](https://github.com/tldr-pages/tldr/wiki/tldr-pages-clients) will choose the most suitable version of the command.
- For `osx`: Apple distributes the built-in man pages [in Xcode](https://developer.apple.com/documentation/os/reading_unix_manual_pages).
For commands documented there, we recommend using <https://keith.github.io/xcode-man-pages/>, an HTML export of all Apple's man pages bundled with Xcode.
In this case, the information of the Windows version of `cd` (stored in `pages/windows/cd.md`) will be displayed by default to Windows users, and a generic/common version (stored in `pages/common/cd.md`) will be displayed for Linux, macOS, and other platforms.
> [!IMPORTANT]
> All links must be enclosed inside angular brackets (`<` and `>`).
When writing descriptions for command examples, **check for any grammatical errors**. `Go to the specified directory` is preferred instead of:
- It is suggested to use a more information link with English content in both translations and English pages. That's because the links can eventually change, but the translations are often out of sync with the English pages.
- `Going to the specified directory` (should not be in present participle form)
- `This command will go to the specified directory` (it is clear that this example works for *this* comment)
- `Let's go to the specified directory!`
- `Directory change` (use the active form instead of passive, if possible)
#### Versioned links
For instance, instead of `Listing all files:`, `List all files:` can be used as the example's description below:
When a utility or distribution has versioned links for the packages, link to the most recent version of documentation (i.e. `latest`) or none if the website automatically redirects to the latest version of the documentation.
```md
- Listing all files:
For example, use:
`ls`
```
- <https://manpages.debian.org/latest/apt/apt.8.html> instead of <https://manpages.debian.org/bookworm/apt/apt.8.en.html>.
- <https://docs.aws.amazon.com/cdk/latest/guide/cli.html> instead of <https://docs.aws.amazon.com/cdk/v2/guide/cli.html>.
### Wording
#### Microsoft Learn links
- All descriptions **must be concise**.
- Avoid using the page title in the description (e.g. use `A sketching and painting program designed for digital artists` instead of `Krita is a sketching and painting program designed for digital artists`) unless the program name differs from the executable name (e.g. `rg` and Ripgrep).
- Avoid mentioning that the program is used on the command-line (e.g. use `Ripgrep is a recursive line-oriented search tool` instead of `Ripgrep is a recursive line-oriented CLI search tool`).
- For example, when writing documentation for `cd`, a tool to change the current working directory in the Terminal or Command Prompt, **do not** write a lengthy description such as:
When linking pages to the Microsoft Learn links, remove the locale from the address as the website will automatically redirect to the reader's preferred locale setting.
For example, Use <https://learn.microsoft.com/windows-server/administration/windows-commands/cd> instead of
<https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd>.
```md
> `cd` is a system tool, available in Windows, macOS, and Linux, to change the current working directory to get things done in the Command Prompt, Terminal, and PowerShell.
```
Additionally, if the link is related to PowerShell command documentation, remove the **documentation version indicator** (in which the version of PowerShell/module that the documentation is derived from), aka.
the part of the address that starts with `?view=`.
It should instead be simplified to make it easier for everyone to read:
- Use <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string> instead of <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-string?view=powershell-7.4>.
- Use <https://learn.microsoft.com/powershell/module/powershellget/install-module> instead of <https://learn.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershellget-1.x>.
```md
> Change the current working directory.
```
### Formatting
- Proper names should be capitalized in the description whenever applicable (e.g. use `A tool for interacting with a Git repository.` instead of ``A tool for interacting with a `git` repository.``).
- Acronym expansions (i.e. protocols, tools, etc) must not be translated unless there is a recognized native equivalent for them.
- When documenting keycaps or a keyboard shortcut for a utility it is suggested to wrap them in backticks to make them stand out in the description (i.e. ``Print the last lines of a given file and keep reading it until `Ctrl + C`:``). Alternatively, you can document them as a separate command and optionally highlight them as placeholders (i.e. `:wq{{Enter}}` or `:wq<Enter>` or `:wq(Enter)`).
## Emphasis
Do not use *italics*, **boldface** or any other text styling on the pages. These are reserved for client emphasis of placeholders.
## Serial Comma
- When declaring a list of 3 or more items,
use a [serial comma](https://en.wikipedia.org/wiki/Serial_comma),
also known as the Oxford comma,
since omitting it can create ambiguity.
> Delete the Git branches, tags and remotes.
The example above does not use a serial comma, so this could mean one of two things:
- Delete the Git branches named `tags` and `remotes`.
- Delete all of the following: Git branches, Git tags, and Git remotes.
This can be resolved by inserting a comma before the "and" or "or" in the final element in the list.
> Delete the Git branches, tags, and remotes.
## See also section
### See also section
- To reference a related command or subcommand, use:
@ -376,36 +326,136 @@ This can be resolved by inserting a comma before the "and" or "or" in the final
``See also: `date`, for Unix information; `umount`, for unmounting partitions.``
## More information links
## Example descriptions
- On the `More information` link line, we prefer linking to the author's provided documentation of the command line reference or the man page. When not available, use <https://manned.org> as the default fallback for all platforms (except `osx` and BSD platforms other than FreeBSD). Alternatively, you can link to the author's website or a tutorial page if the command doesn't have a documentation page.
### Wording
- For `osx`: Apple distributes the built-in man pages [in Xcode](https://developer.apple.com/documentation/os/reading_unix_manual_pages). For commands documented there, we recommend using https://keith.github.io/xcode-man-pages/, an HTML export of all Apple's man pages bundled with Xcode.
- Avoid using the page title in the description (e.g. use `A sketching and painting program designed for digital artists` instead of `Krita is a sketching and painting program designed for digital artists`)
unless the program name differs from the executable name (e.g. `rg` and Ripgrep).
- Avoid mentioning that the program is used on the command-line (e.g. use `Ripgrep is a recursive line-oriented search tool` instead of `Ripgrep is a recursive line-oriented CLI search tool`).
- For example, when writing documentation for `cd`, a tool to check out and work on a specific directory in the Terminal or Command Prompt, **do not** write a lengthy description such as:
- **All links must be enclosed inside angular brackets (`<` and `>`) for proper rendering in clients.**
```md
> `cd` is a system tool, available in Windows, macOS, and Linux, to check out a specific directory to get things done in the Command Prompt, Terminal, and PowerShell.
```
- We prefer translations to use the more information link of the English page by default.
It should instead be simplified to make it easier for everyone to read:
### Versioned links
```md
> Change the current working directory.
```
When a utility or distribution has versioned links for the packages, we prefer linking to the most recent version of documentation (i.e. `latest`) or none if the website automatically redirects to the latest version of the documentation.
### Formatting
For example, use:
- Proper names should be capitalized in the description whenever applicable (e.g. use `A tool for interacting with a Git repository.` instead of ``A tool for interacting with a `git` repository.``).
- Acronym expansions (i.e. protocols, tools, etc) must not be translated unless there is a recognized native equivalent for them.
- When documenting keycaps or a keyboard shortcut for a utility, to make it stand out in the description:
- <https://manpages.debian.org/latest/apt/apt.8.html> instead of <https://manpages.debian.org/bookworm/apt/apt.8.en.html>.
- <https://docs.aws.amazon.com/cdk/latest/guide/cli.html> instead of <https://docs.aws.amazon.com/cdk/v2/guide/cli.html>.
1. If it is not translatable, enclose it with backticks (i.e. ``Print the last lines of a given file and keep reading it until `Ctrl + C`:``)
2. If it is translatable, enclose it with double angled brackets inside a placeholder (i.e. ``:wq{{<<Enter>>}}``).
### Microsoft Learn links
### Short option mnemonics
When linking pages to the Microsoft Learn links, remove the locale from the address as the website will automatically redirect to the reader's preferred locale setting. For example, Use <https://learn.microsoft.com/windows-server/administration/windows-commands/cd> instead of
<https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd>.
Short option mnemonics are optional hints which can be added to help users understand the meaning of these short options. The assigned mnemonics should match with the ones in the command's official documentation (e.g. from `man` or `Get-Help`). For example:
Additionally, if the link is related to PowerShell command documentation, remove the **documentation version indicator** (in which the version of PowerShell/module that the documentation is derived from), aka. the part of the address that starts with `?view=`.
```md
- [d]isplay the ins[t]allation [i]D for the current device. Useful for offline license activation:
- Use <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string> instead of <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-string?view=powershell-7.4>.
- Use <https://learn.microsoft.com/powershell/module/powershellget/install-module> instead of <https://learn.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershellget-1.x>.
`slmgr.vbs /dti`
## Help and version commands
- Display the current license's e[xp]i[r]ation date and time:
`slmgr.vbs /xpr`
```
Note that, in the first example, the `[d]`, `[t]`, and `[i]` characters are enclosed with square brackets to indicate that the `/dti` option of the command is a combination of "display", "installation", and "ID", respectively.
Group consecutive mnemonic characters under the same square brackets, for example: `e[xp]i[r]ation` instead of `e[x][p]i[r]ation`.
**Mnemonic characters must be written in a case-sensitive manner**, even when it is placed as the first character of the sentence (i.e. use `[d]isplay` instead of `[D]isplay`).
This is to avoid conflicts with GNU-style command options which may interpret uppercase options differently than the lowercase ones, such as `-v` for displaying the command's `[v]ersion` number and `-V` to run the command in `[V]erbose` mode.
Option mnemonics may also be used in translations as long as the highlighted word contains similar meanings to the language (commonly English) which the command is written for.
For example, `[d]ownload` in English may be translated into `[d]escargar` in Spanish, `[i]nstall` in English may be translated to `[i]nstallieren` in German, and `[a]pp` in English may be translated into `[a]plikasi` in Indonesian and Malay.
- Optionally, mnemonics and their enclosed terms can be separated with brackets from the rest of the description (i.e. `([a]ll)`) in translations and specific pages to provide additional context or mention a word not present in the description.
> [!NOTE]
> In cases where the character isn't present in the translated word, you can highlight the option before/next to the equivalent word or you can add the English work beside the translation inside a bracket.
> For example, `E[x]tract` in English maybe translated into `[x] ekstrak` or `ekstrak [x]` or `ekstrak (E[x]tract)` in Indonesian.
## Example commands
### Option syntax
- For commonly/frequently used commands (e.g. `grep`, `tar`, `etc`), we prefer using short options along with [mnemonics](#short-option-mnemonics) or both inside a placeholder.
- For highlighting both long and short options in commands (instead of using mnemonics), combine them within a placeholder i.e. `{{-o|--output}}`.
- For user-friendliness, use **GNU-style long options** (like `--help` rather than `-h`) when they are cross-platform compatible (intended to work the same across multiple platforms) for pages in `common` directory.
### Placeholder syntax
User-provided values should use the `{{placeholder}}` syntax
in order to allow `tldr` clients to highlight them.
> [!TIP]
> It is suggested to enclose placeholders accepting strings as input within quotes. i.e. Use `"{{placeholder}}"` instead of `{{"placeholder"}}`.
Keep the following guidelines in mind when choosing placeholders:
#### Naming
- Use short but descriptive placeholders,
such as `{{path/to/source_file}}` or `{{path/to/wallet.txt}}`.
- Use [`snake_case`](https://wikipedia.org/wiki/snake_case) for multi-word placeholders.
- Use a generic placeholder rather than an actual value where a generic placeholder is available (but there is an exception to this listed below). For example, use
`iostat {{1..infinity}}` rather than `iostat {{2}}`.
- If there are several consecutive placeholders of the same type
which don't allow adding arbitrary text in them (ranges), then instead of generic placeholders use descriptive ones. For example prefer `input swipe {{x_position}} {{y_position}} {{x_position}} {{y_position}} {{seconds}}`
instead of `input swipe {{-infinity..infinity}} {{-infinity..infinity}} {{-infinity..infinity}} {{-infinity..infinity}} {{1..infinity}}`.
#### Paths
- Use `{{filename}}` when just the file name is expected.
- For any reference to paths of files or directories,
use the format `{{path/to/placeholder}}`,
except when the location is implicit.
- When the path cannot be relative,
but has to start at the root of the filesystem,
prefix it with a slash,
such as `get {{/path/to/remote_file}}`.
- In case of a possible reference both to a file or a directory,
use `{{path/to/file_or_directory}}`.
> [!NOTE]
> If the command is specific to Windows, use backslashes (`\`) instead, such as `{{path\to\file_or_directory}}`. Drive letters such as `C:` are optional unless the command input requires an absolute path
> or specific drive letter range, such as `cd /d {{C}}:{{path\to\directory}}`.
#### Extensions
- If a particular extension is expected for the file, append it.
For example, `unrar x {{path/to/compressed.rar}}`.
- In case a generic extension is needed, use `{{.ext}}`, but **only** if an extension is required.
For instance, in `find.md`'s example "Find files by extension" (`find {{path/to/root}} -name '{{*.ext}}'`)
using `{{*.ext}}` explains the command without being unnecessarily specific;
while in `wc -l {{path/to/file}}` using `{{path/to/file}}` (without extension) is sufficient.
#### Grouping placeholders
- If a command can optionally take 1 or more arguments of the same kind, use an ellipsis: `{{placeholder1 placeholder2 ...}}`.
For instance, if multiple paths are expected, use `{{path/to/directory1 path/to/directory2 ...}}`.
- If a command can optionally take 1 or more arguments of different kinds, use an ellipsis: `{{placeholder1|placeholder2|...}}`.
If there are more than 5 possible values, you can use `|...` after the last item.
- It's impossible to restrict the minimum or (and) maximum placeholder count via `ellipsis`.
It's up to the program to decide how to handle duplicating values, provided syntax
tells no info about whether items are mutually exclusive or not.
#### Optional placeholders
When documenting optional placeholders likes paths or file extensions, it is suggested to specify them in the page or example descriptions instead of the placeholder itself. For example:
- Use `{{path/to/source.ext}}` instead of `{{path/to/source.tar[.gz|.bz2|.xz]}}`.
### Help and version commands
- We generally put, **in this order**, the help and version commands as the **last two** examples of the page to highlight more practical commands at the beginning of the page. They can be replaced to accommodate other useful examples if required.
- For consistency, we prefer generic wording `Display help` and `Display version` for these commands.
@ -529,12 +579,15 @@ To ensure that the sentence may not be confused with `start processing the web s
### French-Specific Rules
- Command and example descriptions on pages in French must use the third person singular present indicative tense (présent de l'indicatif à la troisième personne du singulier). For example, use `Extrait une archive` rather than `Extraire une archive` or `Extrais une archive`.
- There must be a single blank space between special characters in the descriptions. For example, use `Plus d'informations : https://example.com.` instead of `Plus d'informations: https://example.com.` and use `Crée une archive à partir de fichiers :` instead of `Crée une archive à partir de fichiers:`.
- Command and example descriptions on pages in French must use the third person singular present indicative tense (présent de l'indicatif à la troisième personne du singulier).
For example, use `Extrait une archive` rather than `Extraire une archive` or `Extrais une archive`.
- There must be a single blank space between special characters in the descriptions.
For example, use `Plus d'informations : https://example.com.` instead of `Plus d'informations: https://example.com.` and use `Crée une archive à partir de fichiers :` instead of `Crée une archive à partir de fichiers:`.
### Portuguese-Specific Rules
Example descriptions on pages in Portuguese (for both European and Brazilian Portuguese) must start with verbs in the third person singular present indicative tense. This is because the descriptions must explain what the commands do, making this the correct form to express the intended meaning.
Example descriptions on pages in Portuguese (for both European and Brazilian Portuguese) must start with verbs in the third person singular present indicative tense.
This is because the descriptions must explain what the commands do, making this the correct form to express the intended meaning.
For example, use `Lista os arquivos` instead of `Listar os arquivos`, `Listando os arquivos` or any other form.