Skip to content

Commit

Permalink
resolves #2858 recognize prompt that contain tilde(s) and/or space(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Nov 13, 2020
1 parent e8a8216 commit 4cd2998
Show file tree
Hide file tree
Showing 7 changed files with 30 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>
3 changes: 2 additions & 1 deletion CHANGES.md
Expand Up @@ -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][]
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/languages/shell.js
Expand Up @@ -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'
}
Expand Down
9 changes: 9 additions & 0 deletions test/markup/shell/prompt-with-space.expect.txt
@@ -0,0 +1,9 @@
<span class="hljs-meta">[root@localhost ~]#</span><span class="bash"> yum list --show-duplicates neo4j-enterprise</span>
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
9 changes: 9 additions & 0 deletions 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
4 changes: 4 additions & 0 deletions test/markup/shell/prompt-with-tilde.expected.txt
@@ -0,0 +1,4 @@
<span class="hljs-meta">~/docs&gt;</span><span class="bash"> cat readme.adoc</span>
= Highlight.js

Highlight.js is a syntax highlighter written in JavaScript.
4 changes: 4 additions & 0 deletions 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.

0 comments on commit 4cd2998

Please sign in to comment.