forked from n-riesco/ijavascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
461 additions
and
225 deletions.
There are no files selected for viewing
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
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,17 @@ | ||
# `TAB` completion | ||
|
||
IJavascript provides a completion list for both Javascript keywords and object | ||
properties. This completion list is shown when `TAB` is pressed: | ||
|
||
![Screenshot: TAB complete | ||
(keywords)](../res/screenshot-notebook-complete-keyword.png) | ||
|
||
It can be used to complete object properties accessed using the dot operator | ||
(`.`): | ||
|
||
![Screenshot: TAB complete (dot)](../res/screenshot-notebook-complete-dot.png) | ||
|
||
or the bracket operator (`[]`): | ||
|
||
![Screenshot: TAB complete | ||
(bracket)](../res/screenshot-notebook-complete-bracket.png) |
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,70 @@ | ||
# Graphical output | ||
|
||
IJavascript provides a number of global variables to produce a graphical output. | ||
|
||
## Text formats | ||
|
||
IJavascript can output `HTML` and `SVG`. | ||
|
||
### `$$html$$` | ||
|
||
To output `HTML` simply assign a string with the HTML to the global variable | ||
`$$html$$`. See the example below: | ||
|
||
```javascript | ||
$$html$$ = "<div style='background-color:olive;width:50px;height:50px'></div>" | ||
``` | ||
|
||
![Screenshot: HTML output](../res/screenshot-notebook-html.png) | ||
|
||
### `$$svg$$` | ||
|
||
Similarly, it is possible to output `SVG` by assigning a string to the global | ||
variable `$$svg$$`: | ||
|
||
```javascript | ||
$$svg$$ = "<svg><rect width=80 height=80 style='fill: orange;'/></svg>" | ||
``` | ||
|
||
![Screenshot: SVG output](../res/screenshot-notebook-svg.png) | ||
|
||
## Binary formats | ||
|
||
IJavascript can also output pictures in `PNG` and `JPEG` formats. However, this | ||
formats are binary and need to be encoded in `base64`. See how in the following | ||
examples. | ||
|
||
### `$$png$$` | ||
|
||
In the below example, a `PNG` file is read, then encoded in `base64` and finally | ||
assigned to the global variable `$$png$$`: | ||
|
||
```javascript | ||
$$png$$ = fs.readFileSync("image.png").toString("base64"); | ||
``` | ||
|
||
![Screenshot: PNG output](../res/screenshot-notebook-png.png) | ||
|
||
### `$$jpeg$$` | ||
|
||
Similarly with `JPEG` files and the global variable `$$jpeg$$`: | ||
|
||
```javascript | ||
$$jpeg$$ = fs.readFileSync("image.jpg").toString("base64"); | ||
``` | ||
|
||
![Screenshot: JPEG output](../res/screenshot-notebook-jpeg.png) | ||
|
||
## MIME output | ||
|
||
IJavascript also provides the global variable `$$mime$$` to produce an output in | ||
any other format understood by the IPython frontend. Following is an example | ||
where instead of assigning an HTML string to the global variable `$$html$$`, the | ||
global variable `$$mime$$` is assigned an object with the HTML string assigned | ||
to the property `"text/html"`: | ||
|
||
```javascript | ||
$$mime$$ = {"text/html": "<div style='background-color:olive;width:50px;height:50px'></div>"}; | ||
``` | ||
|
||
![Screenshot: MIME output](../res/screenshot-notebook-mime.png) |
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,15 @@ | ||
# `Shift-TAB` object inspection | ||
|
||
IJavascript has the capability of inspection the value of an object or its | ||
documentation if available. | ||
|
||
To show the content of a variable, move the cursor to the end of that variable | ||
and press `Shift-TAB`: | ||
|
||
![Screenshot: Shift-Tab inspect | ||
(value)](../res/screenshot-notebook-inspect-value.png) | ||
|
||
When available, IJavascript will show the associated documentation instead: | ||
|
||
![Screenshot: Shift-Tab inspect | ||
(doc)](../res/screenshot-notebook-inspect-doc.png) |
Oops, something went wrong.