diff --git a/CHANGES.md b/CHANGES.md index 69d6f1fc39..60e4f5512b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Core Grammars: - fix(diff) fix unified diff hunk header regex to allow unpaired numbers [Chris Wilson][] - enh(php) support single line and hash comments in attributes, constructor and functions [Antoine Musso][] - enh(json) add json5 support [Kerry Shetline][] +- enh(shell) match period (.) as part of shell prompt [Ian Wienand][] Documentation: @@ -46,6 +47,7 @@ CONTRIBUTORS [Kerry Shetline]: https://github.com/kshetline [Twineee1]: https://github.com/Twineee1 [hbgl]: https://github.com/hbgl +[Ian Wienand]: https://github.com/ianw ## Version 11.11.1 diff --git a/src/languages/shell.js b/src/languages/shell.js index 2fd6337409..0d3a38825c 100644 --- a/src/languages/shell.js +++ b/src/languages/shell.js @@ -20,7 +20,7 @@ export default function(hljs) { // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result. // For instance, in the following example, it would match "echo /path/to/home >" as a prompt: // echo /path/to/home > t.exe - begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/, + begin: /^\s{0,3}[./~\w\d[\]()@-]*[>%$#][ ]?/, starts: { end: /[^\\](?=\s*$)/, subLanguage: 'bash' diff --git a/test/markup/shell/prompt-with-period.expect.txt b/test/markup/shell/prompt-with-period.expect.txt new file mode 100644 index 0000000000..99cb77098b --- /dev/null +++ b/test/markup/shell/prompt-with-period.expect.txt @@ -0,0 +1 @@ +~/git-repo[branch-1.0]$ ls a.file diff --git a/test/markup/shell/prompt-with-period.txt b/test/markup/shell/prompt-with-period.txt new file mode 100644 index 0000000000..5cf46f72b2 --- /dev/null +++ b/test/markup/shell/prompt-with-period.txt @@ -0,0 +1 @@ +~/git-repo[branch-1.0]$ ls a.file