Skip to content

Commit 31fb8bc

Browse files
Added support for Shell sessions
This adds support for a Shell session pseudo language.
2 parents 6f53f74 + 0b48301 commit 31fb8bc

File tree

13 files changed

+108
-6
lines changed

13 files changed

+108
-6
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,11 @@
804804
"title": "Scheme",
805805
"owner": "bacchus123"
806806
},
807+
"shell-session": {
808+
"title": "Shell session",
809+
"require": "bash",
810+
"owner": "RunDevelopment"
811+
},
807812
"smalltalk": {
808813
"title": "Smalltalk",
809814
"owner": "Golmote"

components/prism-bash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,6 @@
192192
for(var i = 0; i < toBeCopied.length; i++) {
193193
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
194194
}
195-
195+
196196
Prism.languages.shell = Prism.languages.bash;
197197
})(Prism);

components/prism-shell-session.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Prism.languages['shell-session'] = {
2+
'command': {
3+
pattern: /\$(?:[^\r\n'"<]|(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1|((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*(?:\r\n?|\n)(?:[\s\S])*?(?:\r\n?|\n)\3)+/,
4+
inside: {
5+
'bash': {
6+
pattern: /(\$\s*)[\s\S]+/,
7+
lookbehind: true,
8+
alias: 'language-bash',
9+
inside: Prism.languages.bash
10+
},
11+
'sh': {
12+
pattern: /^\$/,
13+
alias: 'important'
14+
}
15+
}
16+
},
17+
'output': {
18+
pattern: /.(?:.*(?:\r\n?|\n|.$))*/
19+
// output highlighting?
20+
}
21+
}

components/prism-shell-session.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-shell-session.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<h2>Full example</h2>
2+
<pre><code>$ git checkout master
3+
Switched to branch 'master'
4+
Your branch is up-to-date with 'origin/master'.
5+
$ git push
6+
Everything up-to-date
7+
$ echo "Foo
8+
> Bar"
9+
Foo
10+
Bar</code></pre>

plugins/autoloader/prism-autoloader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"sass": "css",
9393
"scss": "css",
9494
"scala": "java",
95+
"shell-session": "bash",
9596
"smarty": "markup-templating",
9697
"soy": "markup-templating",
9798
"swift": "clike",

plugins/autoloader/prism-autoloader.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"sas": "SAS",
113113
"sass": "Sass (Sass)",
114114
"scss": "Sass (Scss)",
115+
"shell-session": "Shell session",
115116
"sql": "SQL",
116117
"soy": "Soy (Closure Template)",
117118
"tap": "TAP",

plugins/show-language/prism-show-language.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)