Skip to content

Commit

Permalink
DQA changes
Browse files Browse the repository at this point in the history
  • Loading branch information
poeschko committed Jul 25, 2019
1 parent 2995b84 commit e4e4cc3
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 126 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# wolfram-notebook-embedder

A library to embed [Wolfram Cloud](https://www.wolframcloud.com/) notebooks on other sites. It does *not* use an `<iframe>` but renders a notebook directly into a given DOM node, for a more seamless experience.
A library to embed [Wolfram Cloud](https://www.wolframcloud.com/) notebooks on other sites. It does *not* use an `<iframe>`, but renders a notebook directly into a given DOM node for a more seamless experience.

## Installation

If you're using a package manager such as [npm](https://www.npmjs.com/get-npm) or [Yarn](https://yarnpkg.com/en/), you can install this package from the npm repository:
If you are using a package manager such as [npm](https://www.npmjs.com/get-npm) or [Yarn](https://yarnpkg.com/en/), you can install this package from the npm repository:

npm install wolfram-notebook-embedder

Expand All @@ -20,23 +20,23 @@ and then use the global variable `WolframNotebookEmbedder`.

## Usage & Documentation

* [**Getting started**](./docs/GettingStarted.md)
* [Library interface](./docs/LibraryInterface.md)
* [**Getting Started**](./docs/GettingStarted.md)
* [Library Interface](./docs/LibraryInterface.md)
* [Notebook API](./docs/NotebookAPI.md)
* [Server-side rendering](./docs/ServerSideRendering.md)
* [Notebook loading phases](./docs/NotebookLoadingPhases.md)
* [Server-Side Rendering](./docs/ServerSideRendering.md)
* [Notebook Loading Phases](./docs/NotebookLoadingPhases.md)
* [Troubleshooting](./docs/Troubleshooting.md)

## Examples

* [Basic example](./examples/basic.html)
* [Manipulate example](./examples/manipulate.html)
* [Dimensions examples](./examples/dimensions.html)
* [Server-side rendering](./examples/ssr.html)
* [Basic Example](./examples/basic.html)
* [Manipulate Example](./examples/manipulate.html)
* [Dimensions Examples](./examples/dimensions.html)
* [Server-Side Rendering](./examples/ssr.html)

## Browser Support

We support all modern browsers (the last 2 major versions of Chrome, Firefox, Edge, Safari), and Internet Explorer 11. Particularly for IE 11, this library includes an internal "ponyfill" for `Promise`, since this library's API heavily depends on promises.
We support all modern browsers (the last two major versions of Chrome, Firefox, Edge, Safari) and Internet Explorer 11. Particularly for IE 11, this library includes an internal "ponyfill" for `Promise`, since this library's API heavily depends on promises.

## Contributing

Expand All @@ -46,7 +46,7 @@ Everyone is welcome to contribute. Please read the [Contributing guide](CONTRIBU

We use [semantic versioning](https://semver.org/) for this library and its API.

Each version of this library is compatible with a certain range of versions of Wolfram Cloud. Currently, the requirement is Wolfram Cloud 1.50 (which is not released yet) or higher. We try hard not to make any backward-incompatible changes on the Wolfram Cloud side, which would require an update of this library to keep embeddings working.
Each version of this library is compatible with a certain range of versions of the Wolfram Cloud. Currently, the requirement is Wolfram Cloud 1.50 (which has not been released yet) or higher. We try hard not to make any backward-incompatible changes on the Wolfram Cloud side, which would require an update of this library to keep embeddings working.

## License

Expand Down
6 changes: 3 additions & 3 deletions docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: Development
title: Development
---

Please read the [Contributing guide](https://github.com/WolframResearch/wolfram-notebook-embedder/CONTRIBUTING.md) first. By contributing to this repository, you agree to the licensing terms therein.
Please read the [Contributing guide](https://github.com/WolframResearch/wolfram-notebook-embedder/CONTRIBUTING.md) first. By contributing to this repository, you agree to the licensing terms herein.

To install all required dependencies for development of this library, run:

Expand All @@ -15,7 +15,7 @@ To manually test embedded notebooks, run

yarn run-examples

and visit the resulting localhost URL (usually [http://localhost:5000](http://localhost:5000)). On that page, you can enter the path of a notebook on your localhost cloud to embed it.
and visit the resulting localhost URL (usually http://localhost:5000). On that page, you can enter the path of a notebook on your localhost cloud to embed it.

## Documentation

Expand Down Expand Up @@ -51,6 +51,6 @@ Then run

which asks for the new package version, updates `package.json` accordingly, runs a build, creates a Git tag, and publishes the package.

If publishing fails due to missing authentication even though you have run `yarn login`, you might have to delete `~/.npmrc` and log in again (see [this yarn issue](https://github.com/yarnpkg/yarn/issues/4709)).
If publishing fails due to missing authentication even though you have run `yarn login`, you might have to delete `~/.npmrc` and log in again (see [this Yarn issue](https://github.com/yarnpkg/yarn/issues/4709)).

If [two-factor authentication](https://docs.npmjs.com/configuring-two-factor-authentication) is enabled for your account, you will be asked for a one-time password during the publishing process.
12 changes: 6 additions & 6 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ title: Getting Started
---

1. Create a notebook in the [Wolfram Cloud](https://www.wolframcloud.com/) and make it public.
* In the Cloud UI, use the "New Notebook" button and then use the "Share" dialog to make it public.
* From the Wolfram Language, you could deploy notebook content like so:
* In the cloud UI, use the New Notebook button and then use the Share dialog to make it public.
* From the [Wolfram Language](https://www.wolfram.com/language/), you could deploy notebook content like so:

```mathematica
CloudDeploy[Manipulate[Plot[Sin[a * x], {x, 0, 2Pi}], {a, 1, 3}],
Permissions -> {All -> {"Read", "Interact"}}]
```
2. Install this library in your JS project using
2. Install this library in your JavaScript project using
```bash
npm install wolfram-notebook-embedder
Expand All @@ -28,14 +28,14 @@ title: Getting Started
```html
<script crossorigin src="https://unpkg.com/[email protected]/dist/wolfram-notebook-embedder.min.js"></script>
```
3. In your HTML, create a container where you want the notebook to be rendered (let's say `<div id="notebookContainer"></div>`) and add the following JS code:
3. In your HTML, create a container where you want the notebook to be rendered (say `<div id="notebookContainer"></div>`) and add the following JS code:
```js
var embedding = WolframNotebookEmbedder.embed('url', document.getElementById('notebookContainer'));
```
where `url` is the URL of your cloud object from step 1. More details about `embed` are described in the [library interface documentation](./LibraryInterface.md).
4. If you want to control the notebook from your JS code, wait for the `embed` result (a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)) to resolve and then use various [Notebook API methods](./NotebookAPI.md):
4. If you want to control the notebook from your JS code, wait for the `embed` result (a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)) to resolve, and then use various [Notebook API methods](./NotebookAPI.md):
```js
embedding.then(function (nb) {
Expand All @@ -51,4 +51,4 @@ title: Getting Started
})
```
5. If you want to serve static HTML from your server so the notebook can be rendered before JS code is loaded (which also helps with SEO), take a look at [server-side rendering](./ServerSideRendering.md).
6. If you run into any issues, take a look at the [Troubleshooting guide](./Troubleshooting.md). If you think you found a bug, please report it.
6. If you run into any issues, take a look at the [troubleshooting guide](./Troubleshooting.md). If you think you found a bug, please report it.
10 changes: 5 additions & 5 deletions docs/LibraryInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This library exposes a single function `embed` that renders a notebook into a gi
WolframNotebookEmbedder.embed(notebookURL, domNode, attributes)
```

* `notebookURL`: string with a cloud object URL of the notebook to embed, e.g. `'https://www.wolframcloud.com/obj/4beadfbb-84dd-4b26-87b6-bcd30b9abd65'` or `'https://www.wolframcloud.com/obj/myusername/myfolder/mynotebook.nb'`
* `domNode`: a DOM node to render the notebook in, e.g. obtained by `document.getElementById('myContainer')`
* `notebookURL`: a string with a cloud object URL of the notebook to embed, e.g. `'https://www.wolframcloud.com/obj/4beadfbb-84dd-4b26-87b6-bcd30b9abd65'` or `'https://www.wolframcloud.com/obj/myusername/myfolder/mynotebook.nb'`
* `domNode`: a DOM node in which to render the notebook, e.g. obtained by `document.getElementById('myContainer')`
* `attributes `: a JS object with attributes

The following attributes can be given:
Expand All @@ -20,11 +20,11 @@ The following attributes can be given:
* `allowInteract`: whether to enable interactivity in the notebook, which might use the server-side Wolfram Engine for computations; even if this is set to `true` (the default), the `Permissions` of the cloud notebook must also include `All -> {"React", "Interact"}` for interactions to actually work
* `showRenderProgress`: whether to show the render progress indicator at the top of the notebook during the initial loading phase (see [Notebook Loading Phases](./NotebookLoadingPhases.md) for more information); the default is `true`

If the notebook exceeds the given width or height, scrollbars are introduced in that dimension. The default dimensions (`width: null`, `maxHeight: Infinity`) let the notebook adapt to the container node's width (line-wrapping as necessary) and make the container node grow vertically as necessary; so there won't be a vertical scrollbar, and there will only be a horizontal scrollbar if the notebook's contents are inherently wider than the available width (e.g. a graphic with a fixed size). In the case of `maxHeight: null`, the notebook's background will fill out the whole container node even if the notebook content is smaller. See also the [Dimensions examples](../examples/dimensions.html).
If the notebook exceeds the given width or height, scrollbars are introduced in that dimension. The default dimensions (`width: null`, `maxHeight: Infinity`) let the notebook adapt to the container node's width (line-wrapping as necessary) and make the container node grow vertically as necessary, so there won't be a vertical scrollbar, and there will only be a horizontal scrollbar if the notebook's contents are inherently wider than the available width (e.g. a graphic with a fixed size). In the case of `maxHeight: null`, the notebook's background will fill out the whole container node even if the notebook content is smaller.

The embedded notebook needs to be public (i.e. with [Permissions](https://reference.wolfram.com/language/ref/Permissions.html) of at least `All->"Read"`). For interactivity to work, the `"Interact"` permission is needed.

Notebooks on an [Enterprise Private Cloud](https://www.wolfram.com/enterprise-private-cloud/) can be embedded as well, as long as they are public. Just use the cloud object URL pointing to your EPC as the `notebookURL`.
Notebooks on [Wolfram Enterprise Private Cloud (EPC)](https://www.wolfram.com/enterprise-private-cloud/) can be embedded as well, as long as they are public. Just use the cloud object URL pointing to your EPC as the `notebookURL`.

The function `embed` returns a `Promise` resolving to an object with various methods to control the notebook, e.g.:

Expand All @@ -34,6 +34,6 @@ The function `embed` returns a `Promise` resolving to an object with various met
* `removeEventListener(eventName, callback)`: unregisters an event listener
* many other notebook-related functions, e.g. `getDimensions()`, `getCells()`, `evaluateExpression(expr)`

See the [Notebook API documentation](./NotebookAPI.md) for more details about these methods.
See the [notebook API documentation](./NotebookAPI.md) for more details about these methods.

If something goes wrong while loading the notebook (e.g. because there is no notebook at the given `notebookURL`), the returned promise is rejected.
Loading

0 comments on commit e4e4cc3

Please sign in to comment.