Called by Sphinx during phase 0 (initialization).

    :param sphinx.application.Sphinx app: Sphinx application object.
    :param str version: Version of sphinxcontrib-imgur.

    :returns: Extension metadata.
    :rtype: dict

def setup(app, version):
    """Called by Sphinx during phase 0 (initialization).

    :param sphinx.application.Sphinx app: Sphinx application object.
    :param str version: Version of sphinxcontrib-imgur.

    :returns: Extension metadata.
    :rtype: dict
    """
    app.add_config_value('imgur_api_cache_ttl', 172800, False)
    app.add_config_value('imgur_client_id', None, False)
    app.add_config_value('imgur_hide_post_details', False, True)
    app.add_config_value('imgur_target_default_gallery', False, True)
    app.add_config_value('imgur_target_default_largest', False, True)
    app.add_config_value('imgur_target_default_page', False, True)

    app.add_directive('imgur-embed', ImgurEmbedDirective)
    app.add_directive('imgur-image', ImgurImageDirective)
    app.add_node(ImgurEmbedNode, html=(ImgurEmbedNode.visit, ImgurEmbedNode.depart))
    app.add_node(ImgurImageNode, html=(ImgurImageNode.visit, ImgurImageNode.depart))
    app.add_node(ImgurJavaScriptNode, html=(ImgurJavaScriptNode.visit, ImgurJavaScriptNode.depart))
    app.add_role('imgur-description', imgur_role)
    app.add_role('imgur-title', imgur_role)

    app.connect('env-before-read-docs', event_before_read_docs)
    app.connect('doctree-read', event_doctree_read)
    app.connect('env-merge-info', event_env_merge_info)
    app.connect('env-updated', event_env_updated)
    app.connect('doctree-resolved', event_doctree_resolved)

    return dict(parallel_read_safe=True, version=version)