revizify = async (chart, data, replacements) => {
const { spec, program } = reviz.analyzeVisualization(chart);
const filledProgram = replaceHoles(program, replacements);
const formattedProgram = await prettier.format(filledProgram, {
parser: "babel",
plugins: [prettierPluginBabel, prettierPluginEstree]
});
const plot = Function(`return ${formattedProgram}`)()(Plot, data);
return html`
<div>
<link href="https://unpkg.com/prism-theme-night-owl@1.4.0/build/light-no-italics.css" rel="stylesheet">
${plot}
<pre class="language-json">${prism.highlight(
JSON.stringify(spec, null, 2),
prism.languages.js,
"javascript"
)}</pre>
<pre class="language-js" style="color: darkgoldenrod;">${prism.highlight(
formattedProgram,
prism.languages.js,
"javascript"
)}</pre>
</div>
`;
}