Re:Nota: A Document Language for the Browser
by sm1ch on Thursday May 12, 2022 @08:35AM
(#31353102)
The aim seems similar to Quarto (https://quarto.org/) - an "open-source scientific and technical publishing system built on Pandoc" which "create[s] dynamic content with Python, R, Julia, and Observable". @wcrichton how does Nota relate to Quarto and similar prior efforts?
[ Parent
| on HN ]
Re:Nota: A Document Language for the Browser
by wcrichton on Thursday May 12, 2022 @03:03PM
(#31358741)
Quarto is a good example where their design requires users to understand many different DSLs to achieve the end result. Just in their code sample you have:
* 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}}]{
...
}Thanks! Your answer also suggests a tradeoff: the academics around me would fairly easily get used to YAML/md/etc but would struggle to internalize `let`, `export` and similar notions needed just to declare metadata in your example `%(export let metadata = {`. So it looks like Quarto caters to this population too, at the cost of being less streamlined for those wanting to include code and structured instructions, whereas Nota is more natural for coders at the cost of potentially losing the non-coding academics. Fair?