In [1]:
$$html$$ = "<div style='background-color:olive;width:50px;height:50px'></div>";
Out[1]:
In [2]:
$$svg$$ = "<svg><rect width=80 height=80 style='fill: orange;'/></svg>";
Out[2]:
In [3]:
$$png$$ = require("fs").readFileSync("image.png").toString("base64");
Out[3]:
In [4]:
$$jpeg$$ = require("fs").readFileSync("image.jpg").toString("base64");
Out[4]:
IJavascript also provides the global variable $$mime$$
to produce an output in
any other format understood by the IPython frontend. Following is an example
where instead of assigning an HTML string to the global variable $$html$$
, the
global variable $$mime$$
is assigned an object with the HTML string assigned
to the property "text/html"
:
In [5]:
$$mime$$ = {"text/html": "<div style='background-color:olive;width:50px;height:50px'></div>"};
Out[5]: