Skip to content

MD014 - commands-show-output

Description

This rule triggers when code blocks show shell commands preceded by dollar signs ($), but none of the commands show any output. The dollar signs are unnecessary in this case and make the code harder to copy/paste.

Rationale

It is easier to copy/paste shell commands and less noisy if the dollar signs are omitted when they are not needed. Dollar signs are only useful when distinguishing between typed commands and their output.

Examples

Invalid

# Invalid Document

All commands have dollar signs but no output:

```bash
$ ls
$ cat foo
$ less bar
```

Valid

# Valid Document

Commands without dollar signs:

```bash
ls
cat foo
less bar
```

Commands with output showing:

```bash
$ ls
foo bar
$ cat foo
Hello world
```