Skip to content

fix(bash): highlight command line options (--option)#4376

Open
KJyang-0114 wants to merge 2 commits intohighlightjs:mainfrom
KJyang-0114:fix/issue-4288-bash-highlight
Open

fix(bash): highlight command line options (--option)#4376
KJyang-0114 wants to merge 2 commits intohighlightjs:mainfrom
KJyang-0114:fix/issue-4288-bash-highlight

Conversation

@KJyang-0114
Copy link

@KJyang-0114 KJyang-0114 commented Mar 10, 2026

This PR adds highlighting for long command line options (--option) in bash to address issue #4288.

Problem

Previously, command line options like --project, --env, --deployment-package were not highlighted consistently across lines in bash code blocks. Some would have hljs-built_in class while others had no class at all.

Solution

Add an OPTION pattern that highlights long options when they appear after whitespace. This makes CLI examples more readable.

Testing

Tested manually:

epi deployment start --project my-project --env Integration --direct-deploy true

Now outputs:

epi deployment start<span class="hljs-attribute"> --project</span> my-project<span class="hljs-attribute"> --env</span> Integration<span class="hljs-attribute"> --direct-deploy</span> <span class="hljs-literal">true</span>

Test Updates

Updated 2 test expectation files to reflect the new behavior:

  • test/markup/bash/token-containing-keyword.expect.txt
  • test/markup/shell/command-continuation.expect.txt

All tests now pass (1570 passing).

Fixes

Fixes #4288

Add highlighting for long options (--option) in bash to address issue highlightjs#4288.
Previously, command line options like --project, --env were not highlighted
consistently across lines.

This change adds an OPTION pattern that highlights long options when they
appear after whitespace, making them visually distinct in CLI examples.
@KJyang-0114
Copy link
Author

Hi maintainers! This PR has been waiting for review. Is there anything I can improve or address? The change adds proper highlighting for long CLI options (--option) in bash.

Updates test expectations to match the new behavior from PR highlightjs#4376
which adds highlighting for long CLI options (--option) in bash.
@KJyang-0114
Copy link
Author

👋 Hi maintainers! This PR adds highlighting for long CLI options (--option) in bash to fix issue #4288. All tests pass (1570 passing) and the PR is ready to merge. Happy to make any adjustments if needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(Bash) Highlighted colors doesn't look correct

1 participant