Skip to content

Commit d3e8b3c

Browse files
committed
enh(shell) allow period in prompt match (#4244)
Allow a "." to match in the prompt section of shell/console examples.
1 parent 5697ae5 commit d3e8b3c

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Core Grammars:
2626
- enh(json) add json5 support [Kerry Shetline][]
2727
- fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][]
2828
- fix(csharp) Support digit separators [te-ing][]
29+
- enh(shell) match period (.) as part of shell prompt [Ian Wienand][]
2930

3031
Documentation:
3132

src/languages/shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function(hljs) {
2020
// We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
2121
// For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
2222
// echo /path/to/home > t.exe
23-
begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
23+
begin: /^\s{0,3}[./~\w\d[\]()@-]*[>%$#][ ]?/,
2424
starts: {
2525
end: /[^\\](?=\s*$)/,
2626
subLanguage: 'bash'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span class="hljs-meta prompt_">~/git-repo[branch-1.0]$ </span><span class="language-bash"><span class="hljs-built_in">ls</span> a.file</span>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
~/git-repo[branch-1.0]$ ls a.file

0 commit comments

Comments
 (0)