Skip to content

Commit

Permalink
resolve #2860 add support for multiline command
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Nov 13, 2020
1 parent e8a8216 commit ccaa0fe
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Expand Up @@ -309,3 +309,4 @@ Contributors:
- Patrick Scheibe <patrick@halirutan.de>
- Kyle Brown <kylebrown9@github>
- Marcus Ortiz <mportiz08@gmail.com>
- Guillaume Grossetie <ggrossetie@yuzutech.fr>
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -12,6 +12,7 @@ New Languages:

Language Improvements:

- enh(shell) Add support for multiline commands with line continuation `\` (#2861) [Guillaume Grossetie][]
- bug(xml) XML grammar was far too imprecise/fuzzy [Josh Goebel][]
- enh(xml) Improve precision to prevent false auto-detect positives [Josh Goebel][]
- fix(js/ts) Prevent for/while/if/switch from falsly matching as functions (#2803) [Josh Goebel][]
Expand Down Expand Up @@ -58,6 +59,7 @@ New themes:
[Patrick Scheibe]: https://github.com/halirutan
[Kyle Brown]: https://github.com/kylebrown9
[Marcus Ortiz]: https://github.com/mportiz08
[Guillaume Grossetie]: https://github.com/mogztter


## Version 10.3.1
Expand Down
2 changes: 1 addition & 1 deletion src/languages/shell.js
Expand Up @@ -14,7 +14,7 @@ export default function(hljs) {
className: 'meta',
begin: '^\\s{0,3}[/\\w\\d\\[\\]()@-]*[>%$#]',
starts: {
end: '$', subLanguage: 'bash'
end: '[^\\\\]\\s*$', subLanguage: 'bash'
}
}
]
Expand Down
10 changes: 10 additions & 0 deletions test/markup/shell/command-continuation.expect.txt
@@ -0,0 +1,10 @@
<span class="hljs-meta">$</span><span class="bash"> docker run \
--publish=7474:7474 --publish=7687:7687 \
--volume=/neo4j/data:/data \
--volume=/neo4j/plugins:/plugins \
--volume=/neo4j/conf:/conf \
--volume=/logs/neo4j:/logs \
--user=<span class="hljs-string">&quot;<span class="hljs-subst">$(id -u neo4j)</span>:<span class="hljs-subst">$(id -g neo4j)</span>&quot;</span> \
--group-add=<span class="hljs-variable">$groups</span> \
neo4j:3.4
</span>
9 changes: 9 additions & 0 deletions test/markup/shell/command-continuation.txt
@@ -0,0 +1,9 @@
$ docker run \
--publish=7474:7474 --publish=7687:7687 \
--volume=/neo4j/data:/data \
--volume=/neo4j/plugins:/plugins \
--volume=/neo4j/conf:/conf \
--volume=/logs/neo4j:/logs \
--user="$(id -u neo4j):$(id -g neo4j)" \
--group-add=$groups \
neo4j:3.4
3 changes: 2 additions & 1 deletion test/markup/shell/plain-prompt.expect.txt
@@ -1,2 +1,3 @@
<span class="hljs-meta">&gt;</span><span class="bash"> foo</span>
<span class="hljs-meta">&gt;</span><span class="bash"> /bin/sh</span>
<span class="hljs-meta">&gt;</span><span class="bash"> /bin/sh
</span>

0 comments on commit ccaa0fe

Please sign in to comment.