Custom Displayers and jvm-repr

You can control the representation of a class using the Jupyter standard jvm-repr API. For example below we configure integers to be displayed with large heading text. See the Tablesaw tutorial and its source code for a more substantial example that creates an interactive widget, not just HTML.

In [ ]:
import jupyter.Displayer;
import jupyter.Displayers;
Displayers.register(Integer.class, new Displayer<Integer>() {
      @Override
      public Map<String, String> display(Integer value) {
        return new HashMap<String, String>() {{
          put(MIMEContainer.MIME.TEXT_HTML, "<div><h1>" + value + "</h1></div>");
          
        }};
      }
    });
In [ ]:
1+1