diya
diya.diya`text`
const steps = [
[43, 9, 15],
[9, 43, 15],
[9, 15, 43],
];
const svg = diya.render(diya.diya`
${steps.map((values) => values.join(" "))}
--- styles
9, 15, 43: circle r=16 fill=#dbeafe
`);
A tagged template for writing Diya text from data. It returns the text, for render:
- An array interpolates as one line per item, so a list of rows becomes rows of the sketch.
nullandundefinedinterpolate as nothing, and other values as their text.- Text is kept verbatim, as with
String.raw: backslashes are not escapes.
Data-driven diagrams are JavaScript writing Diya text: there are no loops or data in the language itself.