-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for a Shell session pseudo language.
- Loading branch information
Showing
13 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Prism.languages['shell-session'] = { | ||
'command': { | ||
pattern: /\$(?:[^\r\n'"<]|(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1|((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*(?:\r\n?|\n)(?:[\s\S])*?(?:\r\n?|\n)\3)+/, | ||
inside: { | ||
'bash': { | ||
pattern: /(\$\s*)[\s\S]+/, | ||
lookbehind: true, | ||
alias: 'language-bash', | ||
inside: Prism.languages.bash | ||
}, | ||
'sh': { | ||
pattern: /^\$/, | ||
alias: 'important' | ||
} | ||
} | ||
}, | ||
'output': { | ||
pattern: /.(?:.*(?:\r\n?|\n|.$))*/ | ||
// output highlighting? | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h2>Full example</h2> | ||
<pre><code>$ git checkout master | ||
Switched to branch 'master' | ||
Your branch is up-to-date with 'origin/master'. | ||
$ git push | ||
Everything up-to-date | ||
$ echo "Foo | ||
> Bar" | ||
Foo | ||
Bar</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
$ git checkout master | ||
Switched to branch 'master' | ||
Your branch is up-to-date with 'origin/master'. | ||
$ git push | ||
Everything up-to-date | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["function", "git"], | ||
" checkout master" | ||
]] | ||
]], | ||
["output", "Switched to branch 'master'\nYour branch is up-to-date with 'origin/master'.\n"], | ||
|
||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["function", "git"], | ||
" push" | ||
]] | ||
]], | ||
["output", "Everything up-to-date"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
$ echo 'Foo | ||
> Bar' | ||
$ echo "Foo | ||
> Bar" | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"'Foo\n> Bar'" | ||
]] | ||
]] | ||
]], | ||
|
||
["command", [ | ||
["sh", "$"], | ||
["bash", [ | ||
["builtin", "echo"], | ||
["string", [ | ||
"\"Foo\n> Bar\"" | ||
]] | ||
]] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for multi-line strings inside commands. |