[IPython-dev] using the notebook for teaching?
Thu Dec 6 10:27:52 CST 2012
On 12/6/12 10:05 AM, Thomas Kluyver wrote:
> On 6 December 2012 15:28, W Gong <email@example.com
> <mailto:firstname.lastname@example.org>> wrote:
> ipynb could be made more user-friendly, if new buttons are added to
> the tool bar,
> e.g. to add an youtube link, the button prompts for url or the code,
> then auto insert a cell:
> from IPython.display import YouTubeVideo
> I think the challenge is that there is an enormous wealth of things you
> can do in the notebook - far more than we can put into the toolbar, and
> it's pretty heavy even for a hierarchical menu (see the magics menu in
> the Qt console). Is embedding Youtube videos so important to so many
> users that it merits a valuable toolbar button?
> What's interesting is how we integrate the notebook as a way to edit and
> run code, with the notebook as a rich text presentation system.
> Embedding a video needn't go through a Python cell, but at present
> that's simpler than putting the relevant HTML into a Markdown cell. From
> the other direction, we're now talking about ways to embed variable
> references into Markdown cells, and definining a syntax to do that. I
> get the feeling we're missing a coherent approach here.
> To spark discussion, maybe what we need is something like a 'template
> cell', that's in between a client-side Markdown cell and a code cell:
> - Edit syntax something like Jinja2 templates, with fields that you can
> fill in, loops, if clauses, and so on. We're thinking of using Jinja2
> anyway, so let's not invent our own templating language.
> - When you execute it (shift-enter), it is sent to the kernel to render
> the template.
> - Python objects used in fields are rendered according to our display
> protocol, i.e. _repr_html_() will be preferred.
> - In the interface, the rendered output replaces the editor (like a
> Markdown cell) until you double-click to edit it again.
Just as a point of reference, Sage has %html cells. Anything in
<sage></sage> tags is evaluated and converted to latex and rendered with
mathjax. The whole thing is shipped back to the browser and rendered as
html there. So:
The <b>value</b> is <sage>integrate(x^2,(x,0,1))</sage>.
would render as html and the integral calculation is replaced with the
It's not as flexible as what you are imagining, but like I said, it's an
interesting point of reference.
More information about the IPython-dev