Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/lint-bash-blocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint bash code blocks

on:
pull_request:
paths:
- '**/*.md'

jobs:
check-bash-blocks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check for multi-line bash code blocks
run: |
fail=0
while IFS= read -r file; do
# Strip leading ./ so GitHub annotations link to the correct file
clean="${file#./}"
awk -v file="$clean" '
/^```bash/ { in_block=1; lines=0; start=NR; next }
/^```/ && in_block {
if (lines > 1) {
printf "::error file=%s,line=%d::Bash code block has multiple commands. Each block must contain exactly one command.\n", file, start
found=1
}
in_block=0; next
}
in_block && /^[^#]/ && !/^[[:space:]]*$/ { lines++ }
END { if (found) exit 1 }
' "$file" || fail=1
done < <(find . -name '*.md' -not -path './.git/*' -not -name 'CLAUDE.md')

if [ "$fail" -eq 1 ]; then
echo ""
echo "Error: Found bash code blocks with multiple commands."
echo "Each bash code block must contain exactly one command."
exit 1
fi

echo "All bash code blocks contain a single command."
26 changes: 26 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Docs Conventions

## Markdown bash code blocks

Each bash code block must contain exactly one command. Never combine multiple commands in a single block. On the roots.io front-end, bash code blocks have a clipboard copy button that only supports single lines.

Good:

````markdown
```bash
composer require example/package
```

```bash
wp plugin activate example
```
````

Bad:

````markdown
```bash
composer require example/package
wp plugin activate example
```
````
6 changes: 6 additions & 0 deletions bedrock/converting-wordpress-sites-to-bedrock.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Create a new Bedrock installation:

```bash
$ composer create-project roots/bedrock example.com
```

```bash
$ cd example.com
```

Expand Down Expand Up @@ -65,6 +68,9 @@ Activate Lithify and run the conversion command:

```bash
$ wp plugin activate lithify
```

```bash
$ wp lithify
```

Expand Down
14 changes: 9 additions & 5 deletions trellis/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,17 @@ This setup uses three different cache systems:
Monitor Redis usage:

```bash
# Redis CLI
redis-cli
```

# Inside Redis CLI
INFO memory
INFO stats
```bash
redis-cli INFO memory
```

# Monitor real-time commands
```bash
redis-cli INFO stats
```

```bash
redis-cli MONITOR
```