File tree Expand file tree Collapse file tree 9 files changed +28
-15
lines changed Expand file tree Collapse file tree 9 files changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ Core Grammars:
26
26
- enh(json) add json5 support [ Kerry Shetline] [ ]
27
27
- fix(css) ` unicode-range ` parsing, issue #4253 [ Kerry Shetline] [ ]
28
28
- fix(csharp) Support digit separators [ te-ing] [ ]
29
+ - fix(bash) arguments highlight for Bash/Shell, issue #4288 [ tuyen-at-work] [ ]
29
30
30
31
Documentation:
31
32
@@ -55,6 +56,7 @@ CONTRIBUTORS
55
56
[ te-ing ] : https://github.com/te-ing
56
57
[ Anthony Martin ] : https://github.com/anthony-c-martin
57
58
[ NriotHrreion ] : https://github.com/NriotHrreion
59
+ [ tuyen-at-work ] : https://github.com/tuyen-at-work
58
60
59
61
60
62
## Version 11.11.1
Original file line number Diff line number Diff line change @@ -117,6 +117,16 @@ export default function(hljs) {
117
117
relevance : 0
118
118
} ;
119
119
120
+ const BASH_ARGUMENTS = {
121
+ variants : [
122
+ {
123
+ className : "attr" ,
124
+ begin : / [ \t \u0020 ] ( - ) { 1 , 2 } [ \w \d - ] + / ,
125
+ relevance : 0 ,
126
+ } ,
127
+ ] ,
128
+ } ;
129
+
120
130
const KEYWORDS = [
121
131
"if" ,
122
132
"then" ,
@@ -392,6 +402,7 @@ export default function(hljs) {
392
402
contains : [
393
403
KNOWN_SHEBANG , // to catch known shells and boost relevancy
394
404
hljs . SHEBANG ( ) , // to catch unknown shells but still highlight the shebang
405
+ BASH_ARGUMENTS ,
395
406
FUNCTION ,
396
407
ARITHMETIC ,
397
408
COMMENT ,
Original file line number Diff line number Diff line change 1
1
<span class="hljs-comment"># Escaped double-quote is not a string</span>
2
- <span class="hljs-built_in">echo</span> <span class="hljs-string">'"quoted"'</span> | <span class="hljs-built_in">tr</span> -d \" > text.txt
2
+ <span class="hljs-built_in">echo</span> <span class="hljs-string">'"quoted"'</span> | <span class="hljs-built_in">tr</span><span class="hljs-attr"> -d</span> \" > text.txt
Original file line number Diff line number Diff line change 1
1
<span class="hljs-comment"># numbers aren't highlighted in bash as their semantics is</span>
2
2
<span class="hljs-comment"># not strictly defined for command line parameters</span>
3
- $ <span class="hljs-built_in">tail</span> -10 access.log
3
+ $ <span class="hljs-built_in">tail</span><span class="hljs-attr"> -10</span> access.log
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span
2
2
TLS_DIR=<span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>/../src/main/resources/tls"</span>
3
3
ROOT_DIR=<span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>/.."</span>
4
4
5
- jshell -s - << <span class="hljs-string">EOF
5
+ jshell<span class="hljs-attr"> -s</span> - << <span class="hljs-string">EOF
6
6
System.out.printf("Procs: %s%n", getdata())
7
7
EOF</span>
8
8
9
- jshell -s - <<<<span class="hljs-string">'System.out.printf("Procs: %s%n", getdata())'</span>
9
+ jshell<span class="hljs-attr"> -s</span> - <<<<span class="hljs-string">'System.out.printf("Procs: %s%n", getdata())'</span>
10
10
11
11
<span class="hljs-built_in">cat</span> <<< <span class="hljs-string">'$VARIABLE'</span>
12
12
<span class="hljs-built_in">cat</span> <<< <span class="hljs-string">"<span class="hljs-variable">$VARIABLE</span>"</span>
Original file line number Diff line number Diff line change 1
1
<span class="hljs-comment"># a keyword as part of an option</span>
2
- mycmd -- disable-foo
2
+ mycmd<span class="hljs-attr"> -- disable-foo</span>
3
3
4
4
<span class="hljs-comment"># a keyword as part of a parameter</span>
5
5
some-cmd set-some-setting
Original file line number Diff line number Diff line change 7
7
<span class="hljs-keyword">COPY</span><span class="language-bash"> www.conf /etc/php5/fpm/pool.d/</span>
8
8
9
9
<span class="hljs-keyword">RUN</span><span class="language-bash"> apt-get update \
10
- && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql</span>
10
+ && apt-get install<span class="hljs-attr"> -y</span> php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql</span>
11
11
<span class="hljs-keyword">RUN</span><span class="language-bash"> <span class="hljs-built_in">mkdir</span> /tmp/sessions</span>
12
12
13
13
<span class="hljs-keyword">ENV</span> APPLICATION_ENV dev
Original file line number Diff line number Diff line change 1
1
<span class="hljs-meta prompt_">$ </span><span class="language-bash">docker run \
2
- -- publish=7474:7474 -- publish=7687:7687 \
3
- -- volume=/neo4j/data:/data \
4
- -- volume=/neo4j/plugins:/plugins \
5
- -- volume=/neo4j/conf:/conf \
6
- -- volume=/logs/neo4j:/logs \
7
- -- user=<span class="hljs-string">"<span class="hljs-subst">$(id -u neo4j)</span>:<span class="hljs-subst">$(id -g neo4j)</span>"</span> \
8
- -- group-add=<span class="hljs-variable">$groups</span> \
2
+ <span class="hljs-attr"> -- publish</span> =7474:7474<span class="hljs-attr"> -- publish</span> =7687:7687 \
3
+ <span class="hljs-attr"> -- volume</span> =/neo4j/data:/data \
4
+ <span class="hljs-attr"> -- volume</span> =/neo4j/plugins:/plugins \
5
+ <span class="hljs-attr"> -- volume</span> =/neo4j/conf:/conf \
6
+ <span class="hljs-attr"> -- volume</span> =/logs/neo4j:/logs \
7
+ <span class="hljs-attr"> -- user</span> =<span class="hljs-string">"<span class="hljs-subst">$(id -u neo4j)</span>:<span class="hljs-subst">$(id -g neo4j)</span>"</span> \
8
+ <span class="hljs-attr"> -- group-add</span> =<span class="hljs-variable">$groups</span> \
9
9
neo4j:3.4</span>
10
10
<span class="hljs-meta prompt_">> </span><span class="language-bash">/bin/cat \.travis.yml\
11
- -b | <span class="hljs-built_in">head</span> -n1 </span>
11
+ <span class="hljs-attr"> -b</span> | <span class="hljs-built_in">head</span><span class="hljs-attr"> -n1</span> </span>
12
12
1 language: node_js
13
13
<span class="hljs-meta prompt_">> </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">'hello'</span></span>
14
14
hello
Original file line number Diff line number Diff line change 1
- <span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$HOME</span>"</span> -n </span>
1
+ <span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$HOME</span>"</span><span class="hljs-attr"> -n</span> </span>
You can’t perform that action at this time.
0 commit comments