def export_xhtml(html, filename, image_tag=None):
if image_tag is None:<EOL><INDENT>image_tag = default_image_tag<EOL><DEDENT>else:<EOL><INDENT>image_tag = ensure_utf8(image_tag)<EOL><DEDENT>with open(filename, '<STR_LIT:w>') as f:<EOL><INDENT>offset = html.find("<STR_LIT>")<EOL>assert offset > -<NUM_LIT:1>, '<STR_LIT>'<EOL>html = ('<STR_LIT>'+<EOL>html[offset+<NUM_LIT:6>:])<EOL>html = fix_html(html)<EOL>f.write(IMG_RE.sub(lambda x: image_tag(x, path = None, format = "<STR_LIT>"),<EOL>html))<EOL><DEDENT>
Export the contents of the ConsoleWidget as XHTML with inline SVGs.

    Parameters:
    -----------
    html : str,
        A utf-8 encoded Python string containing the Qt HTML to export.

    filename : str
        The file to be saved.

    image_tag : callable, optional (default None)
        Used to convert images. See ``default_image_tag()`` for information.