Skip to content

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Jan 4, 2026

The current bash command code blocks are highlighted inconsistently because some code blocks got detected as Ruby, so Ruby highlighting is applied. This has been addressed in #1538.

Screenshot 2026-01-04 at 18 31 29

But after the PR, we don't have any highlighting for bash, which I think we can provide rather simply.

With this PR, we can highlight code blocks tagged as sh, shell, bash, and console with a simple JS highlighter.

Screenshot 2026-01-04 at 18 30 02

@matzbot
Copy link
Collaborator

matzbot commented Jan 4, 2026

🚀 Preview deployment available at: https://456d69d1.rdoc-6cd.pages.dev (commit: c01b7fc)

@st0012 st0012 force-pushed the highlight-bash-commands branch from 33f140c to b6f5235 Compare January 4, 2026 18:29
@st0012 st0012 force-pushed the highlight-bash-commands branch from b6f5235 to 8bcfca6 Compare January 4, 2026 22:27
@st0012 st0012 marked this pull request as ready for review January 4, 2026 22:28
@st0012 st0012 force-pushed the highlight-bash-commands branch from 8bcfca6 to d920014 Compare January 4, 2026 22:35
Replace language-specific CSS variables (--c-*) with a shared neutral
color palette (--code-*) that can be reused across different syntax
highlighters. This reduces duplication and makes it easier to maintain
consistent colors across C, Ruby, and future language highlighters.

Changes:
- Add --code-cyan and --code-gray to neutral palette
- Remove --c-* semantic variables for C highlighting
- Update .c-* classes to reference neutral --code-* variables
Add a simple shell/bash syntax highlighter for documentation code blocks.
The highlighter is focused on command-line documentation rather than full
bash scripts.

Highlights:
- $ prompts (gray)
- Commands/executables - first word on line (blue)
- Options like -f, --flag, --option=value (cyan)
- Single and double quoted strings (green)
- Comments starting with # (gray, italic)

The highlighter targets code blocks with language classes: bash, sh, shell,
console.

Files added:
- lib/rdoc/generator/template/aliki/js/bash_highlighter.js
- test/rdoc/generator/aliki/highlight_bash_test.rb
@st0012 st0012 force-pushed the highlight-bash-commands branch from d920014 to c01b7fc Compare January 15, 2026 22:29
@st0012 st0012 requested a review from tompng January 15, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants