Liking cljdoc? Tell your friends :D

notespace

Notebook experience in your Clojure namespace

Clojars Project

What is it?

This library is an attempt to answer the following question: can we have a notebook-like experience in Clojure without leaving one's favourite editor?

Status

Everything here is considered experimental, but is arguably becoming very useful.

Version 3 is the one under active development, and it is the one we recommend using in a new project.

Version 3

Usage

See the tutorial, that was generated by this namespace.

(The screencast is outdated -- should be refreshed soon.)

Editor-agnostic workflow

You can use Notespace alongside with any editor or IDE. (details coming soon)

Editor integration

You can have tighter integration with your editor, using the main API functions.

See emacs-config.el as a recommended way to do it. We wish to offer similar solutions in other editors and IDEs.

Background

The creation of version 3 has followed some ideas from our discussions of alternative notation and of evaluation semantics.

Several people's ideas and comments have affected this version. @awb99 @behrica @daslu @ezmiller @genmeblog @jsa-aerial @metasoarous @nickstares @vlaaad @mchampine

Main changes

Here are the main thingss that are changing here, comparing to Version 2:

  • Version 3 offers a different notion of what notespaces and notes are. Arguably, this notion is less strange to the usual Clojure concepts and idioms.
  • Very little extra notation is necessary, and it is just some tiny amount of metadata that determines how things should be rendered.
  • A small set of API functions allows to evaluate code in a way that informs the browser notebook about changes.
  • Time-related Clojure semantics such as futures and delays can be handled in a way that respects and informs the notebook too when values are realized.
  • The new implementation makes things more flexible and easier to extend and experiment with.
  • Data visualizations based on gorilla-ui Hiccup extensions are supported.

Implementation

For state management and event handling at Clojure JVM, we use cljfx's state management logic.

The current rendering engine is based on gorilla-notes, which is a thin wrapper of gorilla-ui.

The client side stack is based on shadow-cljs and reagent.

As with Version 2, we use tools.reader to read the code of the namespace.

Renderers

Rendering is now an abstract notion, and thus Notespace can be extended with different ways of rendering. At least one of them will create static-htmls, based on gorilla-notes. Other potential renderers may rely on Oz or rmarkdown-clojure, or generate and update Pink Gorilla notebooks on the fly.

Known issues

  • Many of the notions, ideas and behaviours of Version 2 are not supported by Version 3 at the moment. Most of them are enabled in a different way. We need to discuss whether to create some backwards compatibility layer.
  • At the moment, this version brings cljfx as a dependency, merely for its state management logic. This means it will run only on some versions of JDK 8.
  • Currently things tend to break when moving across several namespaces. For now, calling (notespace.api/init) is a good habit for such cases.

It follows some ideas from our discussions of alternative notation and of evaluation semantics.

Several people's ideas and comments have affected this version. @awb99 @behrica @daslu @ezmiller @genmeblog @jsa-aerial @metasoarous @nickstares @vlaaad

Version 2

At the moment, Version 2 is used for documentation and testing at ClojisR and ClojisR-examples.

Usage

See the screencast to have an idea about it.

See this example namespace and its rendered html.

Known issues

  • Links to external resources (e.g., images in separate files) will appear at the rendered static html, but are currently invisible at the live-reload view.

Discussion

Hearing your comments, opinions and wishes will help!

#notespace-dev at the Clojurians Zulip.

Relation to other projects

There are several magnificent existing options for literate programming in Clojure: Marginalia, Org-Babel, Gorilla REPL, Pink Gorilla, Clojupyter, Nextjournal, Saite, Oz. Most of them are actively developed.

Creating a separate alternative would be the least desired outcome of the current project. Rather, the hope is to compose and integrate well with some of the other projects. There has been some thoughts and experiments in that direction, and it seems promising.

License

Copyright © 2019 Scicloj

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

Can you improve this documentation? These fine people already did:
daslu, Brandon Ringe & Carsten Behring
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close