def config(name='ckeditor', custom_config='', **kwargs):
        """Config CKEditor.

        :param name: The target input field's name. If you use Flask-WTF/WTForms, it need to set
            to field's name. Default to ``'ckeditor'``.
        :param custom_config: The addition config, for example ``uiColor: '#9AB8F3'``.
            The proper syntax for each option is ``configuration name : configuration value``.
            You can use comma to separate multiple key-value pairs. See the list of available
            configuration settings on
            `CKEditor documentation <https://docs.ckeditor.com/ckeditor4/docs/#!/api/CKEDITOR.config>`_.
        :param kwargs: Mirror arguments to overwritten configuration variables, see docs for more details.

        .. versionadded:: 0.3
        """
        extra_plugins = kwargs.get('extra_plugins', current_app.config['CKEDITOR_EXTRA_PLUGINS'])

        file_uploader = kwargs.get('file_uploader', current_app.config['CKEDITOR_FILE_UPLOADER'])
        file_browser = kwargs.get('file_browser', current_app.config['CKEDITOR_FILE_BROWSER'])

        if file_uploader != '':
            file_uploader = get_url(file_uploader)
        if file_browser != '':
            file_browser = get_url(file_browser)

        if file_uploader or file_browser and 'filebrowser' not in extra_plugins:
            extra_plugins.append('filebrowser')

        language = kwargs.get('language', current_app.config['CKEDITOR_LANGUAGE'])
        height = kwargs.get('height', current_app.config['CKEDITOR_HEIGHT'])
        width = kwargs.get('width', current_app.config['CKEDITOR_WIDTH'])

        code_theme = kwargs.get('code_theme', current_app.config['CKEDITOR_CODE_THEME'])

        wrong_key_arg = kwargs.get('codesnippet', None)
        if wrong_key_arg:
            warnings.warn('Argument codesnippet was renamed to enable_codesnippet and will be removed in future.')

        enable_codesnippet = kwargs.get('enable_codesnippet', wrong_key_arg) or \
            current_app.config['CKEDITOR_ENABLE_CODESNIPPET']

        if enable_codesnippet and 'codesnippet' not in extra_plugins:
            extra_plugins.append('codesnippet')

        enable_csrf = kwargs.get('enable_csrf', current_app.config['CKEDITOR_ENABLE_CSRF'])

        if enable_csrf:
            if 'csrf' not in current_app.extensions:
                raise RuntimeError("CSRFProtect is not initialized. It's required to enable CSRF protect, \
                    see docs for more details.")
            csrf_header = render_template_string('''
                fileTools_requestHeaders: {
                    'X-CSRFToken': '{{ csrf_token() }}',
                },''')
        else:
            csrf_header = ''

        return Markup('''
<script type="text/javascript">
    CKEDITOR.replace( "%s", {
        language: "%s",
        height: %s,
        width: %s,
        codeSnippet_theme: "%s",
        imageUploadUrl: "%s",
        filebrowserUploadUrl: "%s",
        filebrowserBrowseUrl: "%s",
        extraPlugins: "%s",
        %s // CSRF token header for XHR request
        %s
    });
</script>''' % (
            name, language, height, width, code_theme, file_uploader, file_uploader, file_browser,
            ','.join(extra_plugins), csrf_header, custom_config))