Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shiba6v committed Jul 14, 2019
1 parent 30ad5a7 commit b16218a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -3,4 +3,11 @@
## Installation
```
jupyter nbextension install https://github.com/shiba6v/jupyter-shape-commentator/archive/master.zip --user
```


## Installation for Development
```
cd /path/to
jupyter nbextension install . --user
```
28 changes: 21 additions & 7 deletions jupyter-shape-commentator.js
Expand Up @@ -15,14 +15,28 @@ define([
}

function shape_erase(){
var parent = document.getElementsByClassName("end_space")[0];
while (parent.firstChild) {
parent.removeChild(parent.firstChild);
// var parent = document.getElementsByClassName("end_space")[0];
// while (parent.firstChild) {
// parent.removeChild(parent.firstChild);
// }
// var cell = Jupyter.notebook.get_selected_cell();
// var orig_text = cell.get_text();
// cell.set_text("%%shape_erase"+"\\n"+orig_text);
// cell.execute();
var output_callback = function (out_data){
console.log(out_data);
};
var callbacks = {
iopub: {
output: output_callback
}
}
var cell = Jupyter.notebook.get_selected_cell();
var orig_text = cell.get_text();
cell.set_text("%%shape_erase"+"\\n"+orig_text);
cell.execute();
var options = {
silent: false,
store_history : true,
stop_on_error: false
};
cell.notebook.kernel.execute(code, callbacks, options);
}
function load_ipython_extension() {
// if (document.getElementById('shape_commentator_button')!=null){
Expand Down
3 changes: 2 additions & 1 deletion jupyter-shape-commentator.yaml
Expand Up @@ -2,4 +2,5 @@ Type: IPython Notebook Extension
Name: Jupyter Shape Commentator
Description: You can add shape comments to your code.
Link: README.md
Main: jupyter-shape-commentator.js
Main: jupyter-shape-commentator.js
Compatibility: 4.x, 5.x

0 comments on commit b16218a

Please sign in to comment.