diff --git a/src/languages/bash.js b/src/languages/bash.js index 44f9beba97..f79cbc6a22 100644 --- a/src/languages/bash.js +++ b/src/languages/bash.js @@ -145,6 +145,13 @@ export default function(hljs) { // to consume paths to prevent keyword matches inside them const PATH_MODE = { match: /(\/[a-z._-]+)+/ }; + // Command long options (--option) - only match long options to avoid conflicts + const OPTION = { + className: 'attribute', + begin: /\s--[\w-]+/, + relevance: 0 + }; + // http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html const SHELL_BUILT_INS = [ "break", @@ -397,6 +404,7 @@ export default function(hljs) { COMMENT, HERE_DOC, PATH_MODE, + OPTION, QUOTE_STRING, ESCAPED_QUOTE, APOS_STRING, diff --git a/test/markup/bash/token-containing-keyword.expect.txt b/test/markup/bash/token-containing-keyword.expect.txt index 90f9d8df2f..380431914a 100644 --- a/test/markup/bash/token-containing-keyword.expect.txt +++ b/test/markup/bash/token-containing-keyword.expect.txt @@ -1,5 +1,5 @@ # a keyword as part of an option -mycmd --disable-foo +mycmd --disable-foo # a keyword as part of a parameter some-cmd set-some-setting diff --git a/test/markup/shell/command-continuation.expect.txt b/test/markup/shell/command-continuation.expect.txt index 056b9eb520..b71d22d66f 100644 --- a/test/markup/shell/command-continuation.expect.txt +++ b/test/markup/shell/command-continuation.expect.txt @@ -1,11 +1,11 @@ $ 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 \ + --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 > /bin/cat \.travis.yml\ -b | head -n1