top | item 31358741

(no title)

wcrichton | 3 years ago

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}}]{
      ...
    }

discuss

order

sm1ch|3 years ago

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?

jjallr|3 years ago

FWIW Quarto does allow you to include arbitrary markdown in fig-cap. So this is valid:

    #| fig-cap: A **line plot** on a _polar axis_