Nota: A Document Language for the Browser
nota-lang.org
nota-lang.org
My hope is that in the near-term, I (or other early-adopters) will create a gallery of documents that use Nota's features to convey information in a compelling way. Those examples will convince more people to adopt Nota for their blog or website. Maybe a forward-looking academic workshop convinces its authors to write their papers in Nota. And eventually some Nota will gather some institutional momentum to fund its development. Once there are enough Nota documents worth archiving, then people/orgs will invest resources into archival stability.
So right now, I'm more interested in convincing people that using Nota can enable them to write documents that are significantly better for readers without significantly more effort on behalf of the authors.
Re documents that would be useful, you could dogfood Nota with 242 to show how powerful it could be to teach students PL theory. A course like 15-312 would be much less intimidating for students if materials were encoded both informally/formally in Nota. You could imagine porting one chapter from PFPL as a small example.
I'm teaching a new course on algorithms in the spring and I plan to try it out to develop some online course materials. Will get in touch with you with any questions / to share what we prototype. You might also want to share this with Umut who has been developing (what I believe is) a KaTeX-based system called Diderot that a lot of CMU courses are using now.
I would be happy to support y'all in using Nota for the new course. And I hadn't heard about Diderot, I will reach out to Umut for sure.
Also, what are the differences between it and a CMS, such as a wiki?
The complexity of Javascript and React gives you two main benefits:
1. You can use Javascript as a metalanguage to manipulate the document, e.g. to make and reference variables, perform computations, and so on.
2. You can use React to provide semantic structure and interactivity to your document, e.g. to mark definitions of vocabulary and link references back to the definition.
Nota consists of a syntax, a compiler that goes from Nota document to React program, and a set of React components that are commonly used in Nota documents. You could integrate it into a website or CMS, but it is not inherently any kind of information management system.
I'm always interested in systems that are willing to make the tradeoff of more power and sophistication at the cost of a greater learning curve, and I strongly agree that we need something beyond PDFs and webpages (and Word documents). Nota interests me but I'm having a hard time seeing how the power and sophistication will significantly improve my writing or documents (and I don't develop React applications). A use case would be great; the hyperlinks and tooltips on the page I see can be done much more simply.
If you read my original paper about Nota, you can find a more interesting set of applications: https://willcrichton.net/nota/
The principal question underlying this work is: how much effort does it take to understand a PL paper?
and
Papers about programming languages involve complex notations, systems, and proofs. Static PDFs offer little support in understanding such concepts. I describe Nota, a framework for academic papers that uses the browser's interactive capabilities to support comprehension in context. Nota uses hover effects, tooltips, expandable sections, toggleable explanations, and other interactions to help readers understand a language's syntax and semantics.
1. An alternative syntax (vs. JSX) for writing React programs.
2. A set of React components for structuring a web document
As a syntax, Nota is meant to make writing prose-heavy React easier. As a set of components, Nota is meant to help readers use the document's structure for understanding the document's content, e.g. by showing the definition of a term when you click on it. It's not a replacement for HTML or Javascript, but an alternative syntax for them with a rich standard library.
I'm curious why not do this in MDX instead? Would that have been possible? It seems like it might be a good base that can then interact with other things (e.g. I'd love to just use this in https://motif.land).
Additionally, I found the composition semantics between Markdown and JSX somewhat confusing. Random whitespace and newlines would sometimes have a very significant effect on the resulting document. It wasn't really clear when you would be in Markdown mode vs. JSX mode.
FWIW the Nota React components (e.g. @Definition and @Ref) could be used with MDX. The Nota syntax and Nota runtime are separate.
Making React part of this makes a lot of sense on one hand, but on the other hand it feels to me that documents should be more long-lived than React might be. So a compromise might be to use React under the hood for components, but to abstract it away in a document DSL. But that might be just overthinking it.
Latex, however cluttered its syntax is, benefits a lot from strong tooling that has matured over the decades.
So I'm wondering what the plans are for nota, given that it is a subset of HTML and a subset of latex (judging from reading the examples).
Why not use commonmark? The dynamic argument is kind of invalid, given that markdown.js and other parsers exist and are used heavily on social media web apps and sites.
If the feature gap can be identified as bringing latex to the web: why not implement something like latex.js, which could be embedded in web browsers similar to how pdf.js changed the web?
The goal isn't really to compete with lightweight markup languages like Markdown. There are plenty of those. The goal is to provide a language for writing complex, interactive documents like academic papers.
It isn't as simple as bringing LaTeX to the web. There are many things that LaTeX cannot do or express (e.g. like a tooltip popping up when you click on a reference to a definition). The goal of Nota is to make things like that possible.
I really need to put some more examples online...
This is an all-in-one-file example:
https://gist.github.com/soegaard/1a12a9c3eccd295f1d91e030f9f...
For the use of Scribble notation to produce React components see line 99.
https://racket.discourse.group/t/urlang-is-javascript-with-a...
The Github repo is here:
I'll be adding an "Examples" page with more interesting content soon.
The reason for using React is that it provides a nice model for components that encapsulate state and interactivity, so a user can just write "@Component{contents}" and the component author can deal with all the tricky UI issues. A design goal for Nota is to be as declarative as possible, while still integrating nicely with Javascript.
file formats, unlike apps, can be declarative. (or pretend to be, but even 'pretend declarative' leads to good tool integrations)
of course saas apps have collaboration and messaging, and file formats don't; whoever figures out how to do messaging in semi-declarative formats will be a player in the 'future of web' space
* YAML for the page metadata (title: ...)
* Markdown (```{python}...```)
* Custom in-text notations (@fig-polar)
* Custom markdown notations (#| label: fig-polar)
Whereas in Nota, this would look like:
%(export let metadata = {
title: "matplotlib demo",
format: {html: {codeFold: true}},
jupyter: "python3"
})
For a demonstration of a line plot on a polar axis, see @Ref{fig-polar}.
@Code[language=Python][label="fig-polar"][figCap="A line plot on a polar axis"]{
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
}
When code or structured data is involved, Nota is "just Javascript" (e.g. exporting metadata, specifying code literals). When text is involved, Nota provides a small core set of sigils like @Component[attr=value]{content}.Note that Quarto's "#| fig-cap" annotation probably doesn't allow for rich text captions, since it only allows strings. But Nota allows deep composition, so you could do:
@Code[figCap=@{A @strong{line plot} on a @em{polar axis}}]{
...
} #| fig-cap: A **line plot** on a _polar axis_There's probably a phrase for what I'm describing but that markdown does well -- something like, keep the "source" as clean as possible and only invoke "code" as absolutely needed. Moreover, strive to be human friendly when you do that.
I'm thinking if I could make use of this in MonsterWriter. The export in MonsterWriter is based on LaTex which is a little tricky to handle.
Props for building this project, and props for making it a MIT license!
There's a broader issue of layout, like if you want to print a Nota document and a figure is split across two pages. I'm not sure how to handle that, or if it even makes sense to. The goal of Nota is to move away from the paper document model, although people of course still like to print things and scribble on them.
Also Nota doesn't absolve you of having to learn React, JS, etc. which is fine. Lightweight markup often winds up being a DSL over some more powerful underlying stack. But the goal is to separate authoring from styling. I.e. at the authoring stage you don't need to specify how a sidenote or a definition list would be implemented. Nota seems to mix these up.
Nota doesn't require users to specify the implementations of things like footnotes. The goal is the user just says "@Footnote{content}" and the document renderer takes care of all the layout. And you can swap in different implementations of the Footnote component.
My preferred approach is a 1. small subset of modern HTML and css 2. (optional) that can link to a common package of JS to do things like partial updates ans autocomplete.
Main point is: Once the page has loaded nothing goes on in the background unless the user is explicitly changing the document, i.e. regardless of how many such pages you open, your CPU quickly goes to 0 and stay there.
So this could work too.
Presumably the responsibility would largely fall on the component authors but I was curious if there were any language-level threat model or mitigation approach in mind here.
garfield_walking_away.jpeg