diff --git a/AUTHORS.txt b/AUTHORS.txt index 1432d17ca0..68d7233d31 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -309,3 +309,4 @@ Contributors: - Patrick Scheibe - Kyle Brown - Marcus Ortiz +- Guillaume Grossetie diff --git a/CHANGES.md b/CHANGES.md index 564d2874c8..851ccd00f2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ New Languages: Language Improvements: +- enh(shell) Recognize prompt which contain tilde `~` and/or spaces (#2859) [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][] @@ -58,7 +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 diff --git a/src/languages/shell.js b/src/languages/shell.js index 3a1bc033ad..8a9b97ff96 100644 --- a/src/languages/shell.js +++ b/src/languages/shell.js @@ -12,7 +12,7 @@ export default function(hljs) { contains: [ { className: 'meta', - begin: '^\\s{0,3}[/\\w\\d\\[\\]()@-]*[>%$#]', + begin: '^\\s{0,3}[/~\\s\\w\\d\\[\\]()@-]*[>%$#]', starts: { end: '$', subLanguage: 'bash' } diff --git a/test/markup/shell/prompt-with-space.expect.txt b/test/markup/shell/prompt-with-space.expect.txt new file mode 100644 index 0000000000..c4d42cbae6 --- /dev/null +++ b/test/markup/shell/prompt-with-space.expect.txt @@ -0,0 +1,9 @@ +[root@localhost ~]# yum list --show-duplicates neo4j-enterprise +Loaded plugins: fastestmirror, langpacks +Loading mirror speeds from cached hostfile + * base: mirror.cc.columbia.edu + * extras: mirror.es.its.nyu.edu + * rpmforge: repoforge.mirror.constant.com + * updates: mirrors.greenmountainaccess.net +Installed Packages +neo4j-enterprise.noarch 2.2.5-1 @neo4j diff --git a/test/markup/shell/prompt-with-space.txt b/test/markup/shell/prompt-with-space.txt new file mode 100644 index 0000000000..267491eaf2 --- /dev/null +++ b/test/markup/shell/prompt-with-space.txt @@ -0,0 +1,9 @@ +[root@localhost ~]# yum list --show-duplicates neo4j-enterprise +Loaded plugins: fastestmirror, langpacks +Loading mirror speeds from cached hostfile + * base: mirror.cc.columbia.edu + * extras: mirror.es.its.nyu.edu + * rpmforge: repoforge.mirror.constant.com + * updates: mirrors.greenmountainaccess.net +Installed Packages +neo4j-enterprise.noarch 2.2.5-1 @neo4j diff --git a/test/markup/shell/prompt-with-tilde.expected.txt b/test/markup/shell/prompt-with-tilde.expected.txt new file mode 100644 index 0000000000..57af2ff5de --- /dev/null +++ b/test/markup/shell/prompt-with-tilde.expected.txt @@ -0,0 +1,4 @@ +~/docs> cat readme.adoc += Highlight.js + +Highlight.js is a syntax highlighter written in JavaScript. diff --git a/test/markup/shell/prompt-with-tilde.txt b/test/markup/shell/prompt-with-tilde.txt new file mode 100644 index 0000000000..ddbfcf84e3 --- /dev/null +++ b/test/markup/shell/prompt-with-tilde.txt @@ -0,0 +1,4 @@ +~/docs> cat readme.adoc += Highlight.js + +Highlight.js is a syntax highlighter written in JavaScript.