Quickstart

Once you have logged in to Nextjournal, you’ll see an overview of all your notebooks and the groups that you belong to.

The "Add new notebook" button there allows you to create notebooks by either importing existing ones (from Jupyter, R Markdown or others) or you can start out by picking a template:

Picking something from this page will immediately bring you into the Nextjournal editor.

Using the editor

A Nextjournal notebook is composed of nodes of different kinds — each of them providing different functionality. The following video shows how we can combine these nodes to make a notebook that is plotting some uploaded data:

Content Creation and Editing

Nextjournal’s user interface should be fairly intuitive but there might be some gotchas that work differently than in other systems that you should be aware of:

The + button located at the bottom of each node brings up a menu with a list of all node types that you can insert. Here we see how it’s used to insert a new section:

Similarily, the ••• button at the top of each node brings up a list of actions that you can perform on the node. Here we see how it’s used to delete the previously added section:

Selecting text brings up a selection toolbox. You can use it to add text styles (like bold, italic, etc.) or add inline nodes (like LaTeX formulas):

There is also a list of handy keyboard shortcuts and text expansions that you can use to perform most of the above actions.

Coding in Nextjournal

Code cells are a special type of node in Nextjournal. You can use them to execute code in different programming languages.

Here is a very simple example of a code cell inspecting the mtcars dataset that comes included with the R programming language. Once the cell has executed, the result is displayed below it — in this case a table view of the mtcars dataset:

Here is another very simple example of a Python code cell printing "Hi!" to standard output. Nextjournal’s code cells display stdout in a scrolling window that is attached to the bottom of the code cell. Some code cells will have a result and stdout. You can also collapse stdout if it gets too noisy and distracts from the actual result.

print("Hi!")

Runtimes

When you insert a code cell, a runtime is automatically added for the programming language you are working with. All subsequently added code cells for that language will automatically use this runtime unless you change it. Runtimes exist to provide an isolated computational resource for code cells to run in. This means all code cells using the same runtime will share their file system and process state. Each code cell indicates the runtime it uses in its lower right corner, right next to the name of the programming language. The above example, printing "Hi!", is a Python cell that’s using a Python 3 runtime.

Bash Scripts

Bash code cells need to be a bit special because they are used to set up the different runtimes’ environments. Runtimes are isolated from each other so essentially, Bash cells are mere scripts that are attached to a runtime to install packages or set up configuration. Once you add a Bash cell, Nextjournal will automatically assign its script to the previous code cell’s runtime. This is indicated via the "Bash in [language]" label in the lower right of the code cell. Here is a Bash script installing the svgwrite package into its Python runtime environment:

pip install svgwrite

Files

Apart from code cells writing files into their respective runtime’s file system, you can also upload files to your notebook. This is either done via the + button that appears between nodes and selecting File or simply by dragging files into the notebook:

Once a file has finished uploading, it will live in Nextjournal’s content-addressed storage and can be used in any runtime. Code cells can insert the path to an uploaded file via their selection toolbox or the keyboard shortcut Ctrl/Cmd E. The file can then be used like it would be located right inside the runtime’s file system:

Remixing Notebooks

You can copy and edit any notebook in Nextjournal that presents you with a Remix button in the upper right corner of the screen. Remixing is useful for quickly experimenting with interesting content or for using someone else’s work as a basis for your own.

Depending on how the author set up their notebook, a remix can be a perfect copy of the original notebook, including all runtimes’ file system states and code cell results. This is especially attractive for complicated computational tasks like Machine Learning that can be notoriously hard to reproduce. Here is an example of remixing a Machine Learning notebook with all its content, file system state (installed packages, configuration, etc.) and code cell results:

If a notebook was remixed, an indicator at the beginning of the notebook gives you a link back to the original:

What next?

That’s it for the Quickstart. Remember the earlier example of the notebook that plots housing prices? Why not experiment a bit yourself by remixing it:

If you get stuck you can use our "Ask for help" feature that appears right next to code cell errors or you can get in touch by clicking the ? button in the lower right corner of the screen.