Skip to content

Commit e8d66d2

Browse files
authored
Merge pull request #1200 from jcb91/docs
docs updates
2 parents 47baf26 + 359d455 commit e8d66d2

File tree

20 files changed

+120
-103
lines changed

20 files changed

+120
-103
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ All notable changes to this project should be documented in this file.
55

66
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
77
and this project adheres (at least as of 0.3.0!) to
8-
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
8+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

1010
Note also that since this markdown is used to produce our docs at
11-
[jupyter-contrib-nbextensions.readthedocs.io](http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/)
11+
[jupyter-contrib-nbextensions.readthedocs.io](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/)
1212
via [recommonmark](https://github.com/rtfd/recommonmark), (and GitHub links
1313
aren't automatically added by recommonmark), it'd be helpful if you could
1414
explicitly link github PR/issue numbers and any URIs, to make sure our
@@ -760,7 +760,7 @@ New nbextensions, new features and bugfixes:
760760
Updates to readme/docs:
761761

762762
- get docs readable at
763-
[jupyter-contrib-nbextensions.readthedocs.io](http://jupyter-contrib-nbextensions.readthedocs.io/)
763+
[jupyter-contrib-nbextensions.readthedocs.io](https://jupyter-contrib-nbextensions.readthedocs.io/)
764764
- add an auto-enabled nbextension `contrib_nbextensions_help_item`, which
765765
adds a help menu item to point at RTD
766766
- Add missing readmes & yaml links to readmes

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Jupyter notebook extensions
22
===========================
33

44
[![Join the chat at https://gitter.im/ipython-contrib/jupyter_contrib_nbextensions](https://img.shields.io/gitter/room/ipython-contrib/jupyter_contrib_nbextensions.svg?maxAge=3600)](https://gitter.im/ipython-contrib/jupyter_contrib_nbextensions?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5-
[![Documentation Status](https://readthedocs.org/projects/jupyter-contrib-nbextensions/badge/?version=latest)](http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/)
6-
[![Documentation Status](https://readthedocs.org/projects/jupyter-contrib-nbextensions/badge/?version=stable)](http://jupyter-contrib-nbextensions.readthedocs.io/en/stable/)
5+
[![Documentation Status](https://readthedocs.org/projects/jupyter-contrib-nbextensions/badge/?version=latest)](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/)
6+
[![Documentation Status](https://readthedocs.org/projects/jupyter-contrib-nbextensions/badge/?version=stable)](https://jupyter-contrib-nbextensions.readthedocs.io/en/stable/)
77
[![GitHub issues](https://img.shields.io/github/issues/ipython-contrib/jupyter_contrib_nbextensions.svg?maxAge=3600)](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues)
88
<br/>
99
[![Travis-CI Build Status](https://img.shields.io/travis/ipython-contrib/jupyter_contrib_nbextensions.svg?maxAge=3600&label=Travis)](https://travis-ci.org/ipython-contrib/jupyter_contrib_nbextensions)
@@ -47,7 +47,7 @@ Documentation
4747
=============
4848

4949
Documentation for all maintained extensions can be found at
50-
[jupyter-contrib-nbextensions.readthedocs.io](http://jupyter-contrib-nbextensions.readthedocs.io/en/latest)
50+
[jupyter-contrib-nbextensions.readthedocs.io](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest)
5151

5252
In the 4.x Jupyter repository, all extensions that are maintained and active
5353
have at least a yaml file to allow them being configured using the
@@ -221,24 +221,27 @@ which will
221221

222222
For complex or customized installation scenarios, please look at the
223223
documentation for installing notebook extensions, server extensions, nbconvert
224-
pre/postprocessors and templates on the [Jupyter homepage](http://jupyter.org).
224+
pre/postprocessors and templates on the [Jupyter homepage](https://jupyter.org).
225225
More information can also be found in the
226226
[Wiki](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/wiki).
227227

228-
See also [installing Jupyter](http://jupyter.readthedocs.io/en/latest/install.html)
228+
See also [installing Jupyter](https://jupyter.readthedocs.io/en/latest/install.html)
229229

230230

231231
Notebook extension structure
232232
============================
233233

234-
The nbextensions are stored each as a separate subdirectory of `src/jupyter_contrib_nbextensions/nbextensions`
235-
Each notebook extension typically has it's own directory containing:
234+
The nbextensions are stored in the repository each as a separate subdirectory of
235+
`src/jupyter_contrib_nbextensions/nbextensions`.
236236

237-
* `thisextension/main.js` - javascript implementing the extension
238-
* `thisextension/main.css` - optional CSS
239-
* `thisextension/readme.md` - readme file describing the extension in markdown format
240-
* `thisextension/config.yaml` - file describing the extension to the `jupyter_nbextensions_configurator` server extension
237+
Each notebook extension typically has its own directory named after the extension, containing:
241238

239+
* `thisextension/thisextension.js` - javascript implementing the nbextension
240+
* `thisextension/thisextension.yml` - file describing the nbextension to the `jupyter_nbextensions_configurator` server extension
241+
* `thisextension/thisextension.css` - optional CSS file, which may be loaded by the javascript
242+
* `thisextension/README.md` - readme file describing the nbextension in markdown format
243+
244+
For further details, see [the documentation at jupyter-contrib-nbextensions.readthedocs.io](http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/internals.html).
242245

243246
Changes
244247
=======

docs/source/install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ which will
153153

154154
For complex or customized installation scenarios, please look at the
155155
documentation for installing notebook extensions, server extensions, nbconvert
156-
pre/postprocessors and templates on the [Jupyter homepage](http://jupyter.org).
156+
pre/postprocessors and templates on the [Jupyter homepage](https://jupyter.org).
157157
More information can also be found in the
158158
[Wiki](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/wiki).
159159

160-
See also [installing Jupyter](http://jupyter.readthedocs.io/en/latest/install.html)
160+
See also [installing Jupyter](https://jupyter.readthedocs.io/en/latest/install.html)

docs/source/internals.rst

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,29 @@
33
Notebook extension structure
44
============================
55

6-
The nbextensions are stored each as a separate subdirectory of
7-
`src/jupyter_contrib_nbextensions/nbextensions`
6+
The nbextensions are stored in the repository each as a separate subdirectory of
7+
`src/jupyter_contrib_nbextensions/nbextensions`.
88

9-
Each notebook extension typically has its own directory containing:
9+
Each notebook extension typically has its own directory named after the extension, containing:
1010

11-
* `thisextension/main.js`: javascript implementing the nbextension
12-
* `thisextension/main.css`: optional CSS
13-
* `thisextension/readme.md`: readme file describing the nbextension in markdown format
14-
* `thisextension/config.yaml`: file describing the nbextension to the `jupyter_nbextensions_configurator` server extension
11+
* `thisextension/thisextension.js` - javascript implementing the nbextension
12+
* `thisextension/thisextension.yml` - file describing the nbextension to the `jupyter_nbextensions_configurator` server extension
13+
* `thisextension/thisextension.css` - optional CSS file, which may be loaded by the javascript
14+
* `thisextension/README.md` - readme file describing the nbextension in markdown format
1515

16-
The file names do not need to have the shown names, they can be choosen freely.
17-
This is an example for the `main.js` file:
16+
The file names do not need to have the shown names, they can be chosen freely, as long as they refer to each other using the appropriate names.
17+
This is an example for the main `thisextension.js` file:
1818

1919
.. code-block:: javascript
2020
2121
define([
22+
'require',
2223
'jquery',
2324
'base/js/namespace',
24-
'base/js/utils',
25-
'services/config'
2625
], function (
26+
requirejs
2727
$,
28-
IPython,
29-
utils,
30-
configmod,
28+
Jupyter,
3129
) {
3230
"use strict";
3331
@@ -36,74 +34,90 @@ This is an example for the `main.js` file:
3634
my_config_value : 100
3735
};
3836
39-
// create config object to load parameters
40-
var base_url = utils.get_body_data("baseUrl");
41-
var config = new configmod.ConfigSection('notebook', {base_url: base_url});
42-
43-
// update params with any specified in the server's config file
44-
var update_params = function() {
45-
for (var key in params) {
46-
if (config.data.hasOwnProperty(key))
47-
params[key] = config.data[key];
48-
}
49-
};
50-
51-
// will be called when the config parameters have been loaded
52-
config.loaded.then( function() {
53-
update_params();
54-
55-
});
56-
57-
function config_loaded_callback () {
58-
$.extend(true, params, config.data.thisextension);
37+
var initialize = function () {
38+
// update params with any specified in the server's config file.
39+
// the "thisextension" value of the Jupyter notebook config's
40+
// data may be undefined, but that's ok when using JQuery's extend
41+
$.extend(true, params, Jupyter.notebook.config.thisextension);
42+
43+
// add our extension's css to the page
44+
$('<link/>')
45+
.attr({
46+
rel: 'stylesheet',
47+
type: 'text/css',
48+
href: requirejs.toUrl('./thisextension.css')
49+
})
50+
.appendTo('head');
5951
};
6052
61-
// will be called when the nbextension is loaded
53+
// The specially-named function load_ipython_extension will be called
54+
// by the notebook when the nbextension is to be loaded.
55+
// It mustn't take too long to execute however, or the notebook will
56+
// assume an error has occurred.
6257
var load_ipython_extension = function () {
63-
config.load(); // trigger loading config parameters
64-
58+
// Once the config has been loaded, do everything else.
59+
// The loaded object is a javascript Promise object, so the then
60+
// call return immediately. See
61+
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
62+
// for details.
63+
return Jupyter.notebook.config.loaded.then(initialize);
6564
};
6665
67-
// return public methods
66+
// return object to export public methods
6867
return {
69-
load_jupyter_extension : load_jupyter_extension
68+
load_ipython_extension : load_ipython_extension
7069
};
7170
});
7271
73-
And for the `config.yaml` file:
72+
And for the `thisextension.yml` file:
7473

7574
.. code-block:: yaml
7675
7776
Type: Jupyter Notebook Extension
78-
Compatibility: 4.x
79-
Name: thisextension
80-
Main: main.js
77+
Compatibility: 4.x, 5.x
78+
Name: This Extension
79+
Main: thisextension.js
8180
Icon: icon.png
8281
Link: README.md
8382
Description: My super duper extension
8483
Parameters:
85-
- name: my_config_value
86-
description: A configuration parameter
84+
- name: thisextension.my_config_value
85+
description: Number of dupers to create
8786
input_type: number
8887
min: -1
8988
step: 1
9089
default: 100
9190
92-
When supplying a `readme.md` file, please supply a main heading with the
91+
For further details on the yaml file format, and the option types supported by the configurator, see the `jupyter_nbextension_configurator repo <https://github.com/jupyter-contrib/jupyter_nbextensions_configurator>`__.
92+
93+
When supplying a `README.md` file, please supply a main heading with the
9394
nbextension's title, as this will be linked in the generated documentation at
9495
`jupyter-contrib-nbextensions.readthedocs.io <http://jupyter-contrib-nbextensions.readthedocs.io/en/latest>`__.
95-
This is a simple example for `readme.md`::
96+
This is a simple example for a `README.md`:
97+
98+
.. code-block:: markdown
9699
97100
This extension
98101
==============
99102
100-
How to use
101-
----------
102-
Some description here.
103+
A quick summary of what this nbextension does.
104+
105+
106+
Usage
107+
-----
108+
109+
A more detailed description can go here, maybe covering different variations of functionality, differences in versions or for different kernels etc.
103110
104111
![Screenshot image](screenshot.png)
105112
113+
114+
Options
115+
-------
116+
117+
Some description of the different options the nbextension provides, what they do, and their default values
118+
106119
Internals
107120
---------
121+
108122
How this extension works.
109123

docs/source/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Generating Local Documentation
4545
------------------------------
4646

4747
The documentation can be found online at readthedocs:
48-
<http://jupyter-contrib-nbextensions.readthedocs.io/en/stable/>
48+
<https://jupyter-contrib-nbextensions.readthedocs.io/en/stable/>
4949

5050
If you want to create documentation locally, use
5151

src/jupyter_contrib_nbextensions/nbextensions/code_prettify/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ the options are as follows:
4141

4242
- `mod_name.button_icon`:
4343
A font-awesome class defining the icon used for the toolbar button and
44-
actions. See [http://fontawesome.io/icons] for available icon classes.
44+
actions. See [fontawesome.io/icons] for available icon classes.
4545
Defaults to `fa-legal`.
4646

4747
- `mod_name.button_label`:
@@ -276,7 +276,7 @@ History
276276
[autopep8]: https://github.com/hhatto/autopep8
277277
[code-prettify]: README_code_prettify.md
278278
[jupyter-autopep8]: README_autopep8.md
279-
[http://fontawesome.io/icons]: http://fontawesome.io/icons
279+
[fontawesome.io/icons]: https://fontawesome.io/icons
280280
[internals]: #Internals
281281
[jupyter-autopep8]: https://github.com/kenkoooo/jupyter-autopep8
282282
[jupyter_nbextensions_configurator]: https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator

src/jupyter_contrib_nbextensions/nbextensions/code_prettify/README_2to3.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The options are as follows:
4040

4141
- `2to3.button_icon`:
4242
A font-awesome class defining the icon used for the toolbar button and
43-
actions. See [http://fontawesome.io/icons] for available icon classes.
43+
actions. See [fontawesome.io/icons] for available icon classes.
4444
Defaults to `fa-legal`.
4545

4646
- `2to3.button_label`:
@@ -127,7 +127,7 @@ ways.
127127
[@takluyver]: https://github.com/takluyver
128128
[code_prettify]: https://github.com/jfbercher/code_prettify
129129
[futurize]: http://python-future.org/automatic_conversion.html
130-
[http://fontawesome.io/icons]: http://fontawesome.io/icons
130+
[fontawesome.io/icons]: https://fontawesome.io/icons
131131
[internals]: #Internals
132132
[jupyter_nbextensions_configurator]: https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator
133133
[KerneExecOnCells library]: README.md

src/jupyter_contrib_nbextensions/nbextensions/code_prettify/README_autopep8.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The options are as follows:
4646

4747
- `autopep8.button_icon`:
4848
A font-awesome class defining the icon used for the toolbar button and
49-
actions. See [http://fontawesome.io/icons] for available icon classes.
49+
actions. See [fontawesome.io/icons] for available icon classes.
5050
Defaults to `fa-cog`.
5151

5252
- `autopep8.button_label`:
@@ -125,7 +125,7 @@ calls to the active kernel.
125125
[@kenkoooo]: https://github.com/kenkoooo
126126
[autopep8]: https://github.com/hhatto/autopep8
127127
[code_prettify]: https://github.com/jfbercher/code_prettify
128-
[http://fontawesome.io/icons]: http://fontawesome.io/icons
128+
[fontawesome.io/icons]: https://fontawesome.io/icons
129129
[internals]: #Internals
130130
[jupyter_nbextensions_configurator]: https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator
131131
[KerneExecOnCells library]: README.md

src/jupyter_contrib_nbextensions/nbextensions/code_prettify/README_code_prettify.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The options are as follows:
9595

9696
- `code_prettify.button_icon`:
9797
A font-awesome class defining the icon used for the toolbar button and
98-
actions. See [http://fontawesome.io/icons] for available icon classes.
98+
actions. See [fontawesome.io/icons] for available icon classes.
9999
Defaults to `fa-legal`.
100100

101101
- `code_prettify.button_label`:
@@ -281,8 +281,8 @@ History
281281
[@jfbercher]: https://github.com/jfbercher
282282
[autopep8]: https://github.com/hhatto/autopep8
283283
[formatR]: https://yihui.name/formatr
284-
[http://fontawesome.io/icons]: http://fontawesome.io/icons
285-
[ijavascript]: http://n-riesco.github.io/ijavascript
284+
[fontawesome.io/icons]: https://fontawesome.io/icons
285+
[ijavascript]: https://n-riesco.github.io/ijavascript
286286
[internals]: #Internals
287287
[js-beautify]: https://github.com/beautify-web/js-beautify
288288
[jsonlite]: https://github.com/jeroenooms/jsonlite
@@ -292,5 +292,5 @@ History
292292
[options]: #Options
293293
[prerequisites]: #Prerequisites
294294
[README_autopep8.md]: README_autopep8.md
295-
[this question on stackoverflow]: http://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows
295+
[this question on stackoverflow]: https://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows
296296
[yapf]: https://github.com/google/yapf

src/jupyter_contrib_nbextensions/nbextensions/execute_time/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ and
129129
[jupyter/jupyter_client#143](https://github.com/jupyter/jupyter_client/issues/143),
130130
although they are (now) supposed to, Jupyter kernels don't always specify a
131131
timezone for their timestamps, which can cause problems when the
132-
[moment.js](http://momentjs.com/)
132+
[moment.js](https://momentjs.com/)
133133
library assumes the local timezone, rather than UTC, which is what most kernels
134134
are actually using.
135135
To help to address this, see the [options](#Options) above, which can be used
@@ -179,14 +179,14 @@ strings, for example:
179179
```
180180

181181
The times in the timing areas are formatted using the
182-
[moment.js](http://momentjs.com/) library (already included as part of
182+
[moment.js](https://momentjs.com/) library (already included as part of
183183
Jupyter), but the durations use a custom formatting function, as
184184
I ([@jcb91](https://github.com/jcb91))
185185
couldn't find an existing one that I liked.
186186

187187
The event `execute.CodeCell` is caught in order to create a start time, and add
188188
the timing area with its 'Execution queued at' message.
189-
The extension again uses [moment.js](http://momentjs.com/) for formatting this
189+
The extension again uses [moment.js](https://momentjs.com/) for formatting this
190190
as an ISO string time.
191191

192192
To determine the execution time, the extension patches the Jupyter class
@@ -202,5 +202,5 @@ the `msg.metadata.started` value supplied in the callback, which can be very
202202
different from the time the cell was queued for execution (as a result of
203203
other cells already being executed).
204204
The kernel reply message times are already ISO8601 strings, so no conversion is
205-
necessary, although again, [moment.js](http://momentjs.com/) is used for
205+
necessary, although again, [moment.js](https://momentjs.com/) is used for
206206
parsing and diff'ing them.

0 commit comments

Comments
 (0)