Public
Edited
Sep 2, 2023
Insert cell
Insert cell
// use cors workaround
import {fetchp} from '@tomlarkworthy/fetchp'
Insert cell
msdocreq = fetchp('https://musescore.com/user/498481/scores/6197935')
Insert cell
canvas = {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');

const v = await canvg.Canvg.from(ctx, text);
v.start();
return canvas
}
Insert cell
msdoctext = msdocreq.text()
Insert cell
svgUrl = msdoctext.match(/(?:href=")(.*\.svg.*?)"/)[1]
Insert cell
msdoc = new DOMParser().parseFromString(html, "text/html")
Insert cell
svg2 = msdoc.querySelector('link[href*=".svg"]')
Insert cell
svg = fetchp(svgUrl)
Insert cell
text = svg.text()
Insert cell
canvg = import('https://cdn.skypack.dev/canvg@4.0.1?min')
Insert cell
html`
<div>
${text}
</div>`
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more