Skip to content

Commit 730d493

Browse files
committed
Update README.md
1 parent 08f92f2 commit 730d493

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,31 @@ You can do a bunch of things with it:
1919
## How do I use it?
2020
It's really easy:
2121

22-
1. You include the ``terminal.css`` and ``terminal.js`` files and have a container element (e.g. a div) with a contenteditable element of class ``input`` inside in your HTML document.
22+
1. You include the ``terminal.css`` and ``terminal.js`` files and have a container element (e.g. a div) with a child element holding a contenteditable element of class ``input`` and another span with the actual prompt line you wanna display.
2323
2. You create an object with methods that will be your commands (see below for the details of how this works)
2424
3. Call terminal.init and pass the container element and your commands object - **Ready to roll!**
2525

26+
Here's a minimal example:
27+
28+
```html
29+
<div id="myterminal">
30+
<p>
31+
<span>$> </span>
32+
<span contenteditable="true" class="input"></span>
33+
</p>
34+
</div>
35+
<script src="terminal.js"></script>
36+
<script>
37+
var commands = {
38+
hi: function() {
39+
return '<p>Hi there!</p>'
40+
}
41+
}
42+
43+
Terminal.init(document.getElementById("myterminal"), commands)
44+
</script>
45+
```
46+
2647
## Extensible command interface
2748

2849
The terminal is only a way to interact with "commands" and "commands" are a bundles of functionality.

0 commit comments

Comments
 (0)