Skip to content

Commit 6b8c831

Browse files
authored
(enh) add meta.prompt scope for REPL prompts (#3490)
1 parent c74b08d commit 6b8c831

20 files changed

+78
-75
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ Themes:
55

66
New Grammars:
77

8-
- Added GraphQL to SUPPORTED_LANGUAGES [jf990][]
8+
- Added GraphQL to SUPPORTED_LANGUAGES [John Foster][]
99
- Added Macaulay2 to SUPPORTED_LANGUAGES [Doug Torrance][]
1010

1111
Grammars:
1212

1313
- enh(ruby ) better support multi-line IRB prompts
1414
- enh(bash) improved keyword `$pattern` (numbers allowed in command names) [Martin Mattel][]
15+
- add `meta.prompt` scope for REPL prompts, etc [Josh Goebel][]
1516
- fix(markdown) Handle `***Hello world***` without breaking [Josh Goebel][]
1617
- enh(php) add support for PHP Attributes [Wojciech Kania][]
1718
- fix(java) prevent false positive variable init on `else` [Josh Goebel][]

docs/css-classes-reference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ in mind so a better choice (for best theme support) might possibly be ``string``
8484
| meta | flags, modifiers, annotations, processing |
8585
| | instructions, preprocessor directives, etc |
8686
+--------------------------+-------------------------------------------------------------+
87+
| meta.prompt | REPL or shell prompts or similar |
88+
+--------------------------+-------------------------------------------------------------+
8789
| meta keyword | a keyword inside a meta block |
8890
| | (note this is nested, not subscoped) |
8991
+--------------------------+-------------------------------------------------------------+

src/languages/clojure-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function(hljs) {
1313
name: 'Clojure REPL',
1414
contains: [
1515
{
16-
className: 'meta',
16+
className: 'meta.prompt',
1717
begin: /^([\w.-]+|\s*#_)?=>/,
1818
starts: {
1919
end: /$/,

src/languages/erlang-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function(hljs) {
1919
},
2020
contains: [
2121
{
22-
className: 'meta',
22+
className: 'meta.prompt',
2323
begin: '^[0-9]+> ',
2424
relevance: 10
2525
},

src/languages/julia-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function(hljs) {
2727
name: 'Julia REPL',
2828
contains: [
2929
{
30-
className: 'meta',
30+
className: 'meta.prompt',
3131
begin: /^julia>/,
3232
relevance: 10,
3333
starts: {

src/languages/node-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function(hljs) {
1111
name: 'Node REPL',
1212
contains: [
1313
{
14-
className: 'meta',
14+
className: 'meta.prompt',
1515
starts: {
1616
// a space separates the REPL prefix from the actual code
1717
// this is purely for cleaner HTML output

src/languages/python-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function(hljs) {
1010
aliases: [ 'pycon' ],
1111
contains: [
1212
{
13-
className: 'meta',
13+
className: 'meta.prompt',
1414
starts: {
1515
// a space separates the REPL prefix from the actual code
1616
// this is purely for cleaner HTML output

src/languages/ruby.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export default function(hljs) {
288288
}
289289
},
290290
{
291-
className: 'meta',
291+
className: 'meta.prompt',
292292
begin: '^(' + SIMPLE_PROMPT + "|" + DEFAULT_PROMPT + '|' + RVM_PROMPT + ')(?=[ ])',
293293
starts: {
294294
end: '$',

src/languages/shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function(hljs) {
1616
],
1717
contains: [
1818
{
19-
className: 'meta',
19+
className: 'meta.prompt',
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
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<span class="hljs-meta">user=&gt;</span><span class="language-clojure"> </span>
2-
<span class="hljs-meta">=&gt;</span><span class="language-clojure"> </span>
1+
<span class="hljs-meta prompt_">user=&gt;</span><span class="language-clojure"> </span>
2+
<span class="hljs-meta prompt_">=&gt;</span><span class="language-clojure"> </span>

0 commit comments

Comments
 (0)