Published
Edited
Aug 30, 2020
Insert cell
Insert cell
page0 = html`<strong>This loads a block of HTML as text and gives it the meta data to be html</strong><br><br>
This kind of worked but broke the H1 element<br><br>
<meta content="text/html; charset=UTF-8" ${await FileAttachment("hi.html").text()}>`



Insert cell
page1 = html`<div><strong>This loads a block of HTML and used D3 to inject it into this html cell</strong><br><br>
<div id='page1'></div>
</div>
`
Insert cell
md`** A normal javascript selector could have been used to get the element instead of D3, but I was learning D3 so...**`
Insert cell
{
page1;
d3.select('#page1').html(await FileAttachment("hi.html").text());
}
Insert cell
page2 = html`<div><strong>This loads a block of HTML and uses D3 again to construct an html document from the text fule abd then inject it into this cell</strong><br><br>
<div id='page2'></div>
</div>
`
Insert cell
{
page2;
d3.select('#page2').html( html_doc.body.innerHTML );
}
Insert cell
html_doc = d3.html(await FileAttachment("hi.html").url())
Insert cell
d3 = require("d3@6")

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