Skip to content

Commit 2e0f224

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 e7041c4 commit 2e0f224

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Core Grammars:
2121
- fix(diff) fix unified diff hunk header regex to allow unpaired numbers [Chris Wilson][]
2222
- enh(php) support single line and hash comments in attributes, constructor and functions [Antoine Musso][]
2323
- enh(json) add json5 support [Kerry Shetline][]
24+
- enh(shell) match period (.) as part of shell prompt [Ian Wienand][]
2425

2526
Documentation:
2627

@@ -46,6 +47,7 @@ CONTRIBUTORS
4647
[Kerry Shetline]: https://github.com/kshetline
4748
[Twineee1]: https://github.com/Twineee1
4849
[hbgl]: https://github.com/hbgl
50+
[Ian Wienand]: https://github.com/ianw
4951

5052

5153
## Version 11.11.1

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)