Skip to content

Commit 4a977d7

Browse files
authored
Update readme file
1 parent b0f9de2 commit 4a977d7

File tree

1 file changed

+28
-32
lines changed

1 file changed

+28
-32
lines changed

clear_cell_outputs/README.md

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,35 @@ This example shows how to clear all cell outputs at once by clicking on the butt
44

55
![Github Actions Status](https://github.com/yash112-lang/extension-examples/blob/master/clear_cell_outputs/Preview.gif)
66

7-
<!-- A JupyterLab extension for clearing all cells output at once. -->
8-
97
To use it first we need to import the packages
10-
```
11-
import { ToolbarButton } from '@jupyterlab/apputils';
12-
import { DocumentRegistry } from '@jupyterlab/docregistry';
13-
import { NotebookActions, NotebookPanel, INotebookModel } from '@jupyterlab/notebook';
14-
import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application';
15-
import { IDisposable, DisposableDelegate } from '@lumino/disposable';
8+
```ts
9+
// src/index.ts#L1-L19
10+
11+
import {
12+
IDisposable, DisposableDelegate
13+
} from '@lumino/disposable';
14+
15+
import {
16+
JupyterFrontEnd, JupyterFrontEndPlugin
17+
} from '@jupyterlab/application';
18+
19+
import {
20+
ToolbarButton
21+
} from '@jupyterlab/apputils';
22+
23+
import {
24+
DocumentRegistry
25+
} from '@jupyterlab/docregistry';
26+
27+
import {
28+
NotebookActions, NotebookPanel, INotebookModel
29+
} from '@jupyterlab/notebook';
1630
```
1731

1832
Firstly we have to register the plugin information. In this we have to pass a activate **function** & the plugin **id**.
1933

20-
```
34+
```ts
35+
// src/index.ts#L25-L29
2136
const plugin: JupyterFrontEndPlugin<void> = {
2237
activate,
2338
id: 'clear-cell-outputs:buttonPlugin',
@@ -26,7 +41,8 @@ const plugin: JupyterFrontEndPlugin<void> = {
2641
```
2742
Now creating a notebook widget extension that adds a button to the toolbar. For more info [IWidgetExtension](https://jupyterlab.readthedocs.io/en/latest/api/interfaces/docregistry.documentregistry.iwidgetextension.html)
2843

29-
```
44+
```ts
45+
// src/index.ts#L35-L56
3046
export
3147
class ButtonExtension implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel> {
3248

@@ -51,29 +67,9 @@ export
5167
}
5268
```
5369
Now activating the extension
54-
```
70+
```ts
71+
// src/index.ts#L61-L63
5572
function activate(app: JupyterFrontEnd) {
5673
app.docRegistry.addWidgetExtension('Notebook', new ButtonExtension());
5774
};
5875
```
59-
60-
## Requirements
61-
62-
* JupyterLab >= 3.0
63-
64-
## Install
65-
66-
To install the extension, execute:
67-
68-
```bash
69-
pip install clear_cell_outputs
70-
```
71-
72-
## Uninstall
73-
74-
To remove the extension, execute:
75-
76-
```bash
77-
pip uninstall clear_cell_outputs
78-
```
79-

0 commit comments

Comments
 (0)