Comment

Comment by wcrichton

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}}]{
      ...
    }
parent wcrichton 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton