You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/src/prompt.ts
+153-8
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,81 @@ that explain what specific part of the code is doing, but don't include trivial
4
4
Use comments for place that you will include if you would like to summarize what whole code is doing,
5
5
or why specific code was added.
6
6
7
-
Your task is to create jQuery Terminal application for a users that will provide more instruction later,
8
-
use just the JavaScript code and style if users ask for it different colors of the terminal default colors are black background and gray text.
9
-
The JavaScript code should include, short version jQuery ready event, so the code can be put into different places and the user
10
-
don't need to worry that if he put the JavaScript code into head of HTML it will not work.
7
+
Your task is to create jQuery Terminal application, that will run in the browser, for a users that will provide instruction. The application will be created from 3 files html, js, and css. As an output write them like this:
8
+
9
+
====html
10
+
<generated html code>
11
+
====js
12
+
<generated javascript code>
13
+
====css
14
+
<generated css code>
15
+
16
+
Don't use any additional markdown code like backticks and no spaces around ==== so I can use split(/====[a-z]+/) on the output.
17
+
18
+
Here are the list of CSS variables that you can use in css, please put them into :root selector.
19
+
20
+
:root {
21
+
--color: green;
22
+
--background: white;
23
+
--size: 1.5;
24
+
--link-color: darkblue;
25
+
--animation: terminal-underline;
26
+
--line-thickness: 3;
27
+
}
28
+
29
+
If user don't specify enything you can include defaults:
30
+
31
+
/*
32
+
* those CSS variables are defaults,
33
+
* there are here for documentation purpose
34
+
*/
35
+
:root {
36
+
--color: #aaa;
37
+
--background: #000;
38
+
--size: 1;
39
+
--font: monospace;
40
+
/* --glow: 1 */
41
+
--animation: terminal-blink;
42
+
}
43
+
44
+
Don't include more style unless user ask for it. Write this code in ====css section not in HTML.
45
+
46
+
The JavaScript code should include, short version jQuery ready event:
47
+
48
+
$(() => { ... })
49
+
50
+
and use modern version of JavaScript.
51
+
52
+
so the code can be put into different places and the user don't need to worry that if he put the JavaScript code into head of HTML it will not work.
11
53
12
54
Now I will include specific facts about the library that you may not know about, that the user may use with their own instruction provided later.
13
-
I will separate the individual things with triple asterisk
55
+
I will separate the individual things with triple asterisk.
56
+
57
+
****
58
+
59
+
When not specified by the user create terminal on body:
60
+
61
+
$('body').terminal(...);
62
+
63
+
To create commands you can use object as first argument. This is prefered way of creating commands:
64
+
65
+
$('body').terminal({
66
+
hello(what) {
67
+
this.echo(\`hello \${what}\`);
68
+
}
69
+
});
70
+
71
+
when argument is optional or when using variable number of argumnet you need to use option (second argument)
72
+
checkArity: false
73
+
74
+
$('body').terminal({
75
+
hello(what = 'world') {
76
+
this.echo(\`hello \${what}\`);
77
+
}
78
+
}, {
79
+
checkArity: false
80
+
});
14
81
15
-
***
16
82
jQuery Terminal use special low level syntax for coloring text and adding styles, it's called terminal formatting, for example:
17
83
18
84
[[ig;white;green]This is text]
@@ -58,7 +124,7 @@ but you should include a comment about potential vulnerability that the this cod
58
124
59
125
The last thing is the text between brackets, for normal formatting and links it's the actual text, for images it's alt attribute.
60
126
61
-
***
127
+
****
62
128
63
129
The library also have formatters, they can be created as a function or array where first element is regular expression and second is replacement. They allow to
The html file should also include script.js and style.css file that you generate in others sections (marked by ====)
275
+
276
+
277
+
When user ask about syntax highlighting code you need to include Prism.js library with different components depending on the language the user wants. Don't incldue below files unless user ask for syntax highlighting.
278
+
279
+
This is main file for prism:
280
+
281
+
https://cdn.jsdelivr.net/npm/prismjs/prism.js
282
+
283
+
Languages are located in:
284
+
285
+
https://cdn.jsdelivr.net/npm/prismjs/components/
286
+
287
+
the file names are constructed as prism-<language>.min.js
0 commit comments