scrapbook icon indicating copy to clipboard operation
scrapbook copied to clipboard

How do you add custom metadata as you would to display?

Open mpacer opened this issue 5 years ago • 1 comments

When I went to use scrapbook as a replacement for a display call I discovered that you can no longer use custom metadata.

For example, I used to do something like

    display(IPython.display.SVG(flag._repr_mimebundle_()['text/html']), metadata={"filename": flag_def['name']})

To dump the content of a VDOM object to be able to then extract as an SVG automatically with name "flag_def['name'] by using nbconvert.

This is a particular use case that happens to reflect some of the aspects of how scrapbook could be used (since I can use this with papermill to change out the meaning of flag and flag_def parametrically).

However, it more generally points to the need for an escape hatch to attach additional metadata to the displayed object that should be associated with the displayed object in a persistent fashion.

If we think it would be helpful to add a metadata keyword arg to the glue function (that would just get passed through), I would be happy to make the contribution.

mpacer avatar Mar 20 '19 05:03 mpacer

Sounds reasonable to me. Please do feel free to PR the feature.

MSeal avatar Mar 20 '19 13:03 MSeal