But there ain't so such thing as magic. THINGS must surely have
.toHTML()
functions or face being rendered as text. Or mime types. Or something like that. I had a nosey through the code and it turns out that the terminal checks whether THING is one of a number of types of objects it knows how to render. So in particular if I have an instanceof HTMLDivElement
or HTMLIFrameElement
it should render beautifully. Let's check in the shell.First I will need a way of putting HTML inside divs:
pig$ echo '<span style="background-color:red;">pop</span>' | jf '(function(x){ans = document.createElement("div");ans.innerHTML=x;return ans;})(x)'
Now let's make a "subshell":
On that basis making a builtin that spits out HTML should be pretty easy.
No comments:
Post a Comment