Skip to main content

How to import squiggle files into `.mdx` documents

Proof of concept

Consider the following squiggle file‚Äč

In our docusaurus repo, we have a static asset called demo.squiggle. It looks like this

x = 1 to 2
y = {a: x, b: 1e1}
f(t) = normal(t, 1.1)
z = y.b * y.a

We can call f(z) upon the assignments in demo.squiggle like so:

import { SquiggleEditorWithImportedBindings } from "../../src/components/SquiggleEditor";


Notice, you need to wrap the export of @quri/squiggle-components in custom code for dynamicism, please view packages/website/src/components/ in github for details.

Which would then look exactly like