Helper function to compress HTML for saving and displaying.

Treescope HTML renderings are often much larger in size than the original repr because they render objects using many nested HTML elements. However, most of this structure is very repetitive.

This module contains utilities to compress HTML snippets into equivalent JavaScript snippets using zlib, which is supported by Python and also by most modern browsers.


compress_html(html_src[, include_preamble, ...])

Compresses HTML source to an equivalent compressed JavaScript <script> tag.


Returns the preamble script to include before any compressed outputs.