[IPython-dev] custom web notebook cells
Tue Dec 18 07:26:40 CST 2012
On 12/18/12 6:16 AM, Nicholas Bollweg wrote:
> Good brainstorming. I think as I*nb becomes more mainstream, we'll see
> more code generators (or is it the other way?), so these are good things
> to hash out now.
> Offsets are tricky... this would make it such that editing the cell
> without %load_ext blockly is almost guaranteed to break it even if you
> don't edit the blockly region's content.
The point is that CodeMirror keeps track of the offsets. When a cell is
loaded into the editor, all marks stored in the cell metadata are set
and then Codemirror makes sure they follow the text. When the cell is
saved, the offsets are updated. This could be a general mechanism using
cell metadata for providing marked regions in cells, so we don't have to
have a special extension loaded to load the marks and save them.
More information about the IPython-dev