Python recommonmark.transform.AutoStructify() Examples

The following are 30 code examples of recommonmark.transform.AutoStructify(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module recommonmark.transform , or try the search function .
Example #1
Source File: conf.py    From zulip with Apache License 2.0 6 votes vote down vote up
def setup(app: Any) -> None:

    app.add_source_parser(CustomCommonMarkParser)
    app.add_config_value('recommonmark_config', {
        'enable_eval_rst': True,
        # Turn off recommonmark features we aren't using.
        'enable_auto_doc_ref': False,
        'auto_toc_tree_section': None,
        'enable_auto_toc_tree': False,
        'enable_math': False,
        'enable_inline_math': False,
        'url_resolver': lambda x: x,
    }, True)

    # Enable `eval_rst`, and any other features enabled in recommonmark_config.
    # Docs: https://recommonmark.readthedocs.io/en/latest/auto_structify.html
    # (But NB those docs are for master, not latest release.)
    app.add_transform(AutoStructify)

    # overrides for wide tables in RTD theme
    app.add_css_file('theme_overrides.css')  # path relative to _static 
Example #2
Source File: conf.py    From nbgitpuller with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def setup(app):
    app.add_config_value(
        "recommonmark_config",
        {
            "url_resolver": lambda url: github_doc_root + url,
            "auto_toc_tree_section": "Contents",
        },
        True,
    )
    app.add_transform(AutoStructify)
    app.add_stylesheet("custom.css")
    app.add_javascript("link_gen/link.js")


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. 
Example #3
Source File: conf.py    From DeepForest with MIT License 6 votes vote down vote up
def setup(app: Any) -> None:
    app.add_source_parser(CustomCommonMarkParser)
    app.add_config_value(
        'recommonmark_config',
        {
            'enable_eval_rst': True,
            # Turn off recommonmark features we aren't using.
            'enable_auto_doc_ref': False,
            'auto_toc_tree_section': None,
            'enable_auto_toc_tree': False,
            'enable_math': False,
            'enable_inline_math': False,
            'url_resolver': lambda x: x,
        },
        True)

    # Enable `eval_rst`, and any other features enabled in recommonmark_config.
    # Docs: http://recommonmark.readthedocs.io/en/latest/auto_structify.html
    # (But NB those docs are for master, not latest release.)
    app.add_transform(AutoStructify)

    # overrides for wide tables in RTD theme
    app.add_stylesheet('theme_overrides.css')  # path relative to _static 
Example #4
Source File: conf.py    From detectron2 with Apache License 2.0 6 votes vote down vote up
def setup(app):
    from recommonmark.transform import AutoStructify

    app.connect("autodoc-skip-member", autodoc_skip_member)
    # app.connect('autodoc-skip-member', autodoc_skip_member)
    app.add_config_value(
        "recommonmark_config",
        {
            "url_resolver": url_resolver,
            "auto_toc_tree_section": "Contents",
            "enable_math": True,
            "enable_inline_math": True,
            "enable_eval_rst": True,
        },
        True,
    )
    app.add_transform(AutoStructify) 
Example #5
Source File: conf.py    From SparseSC with MIT License 6 votes vote down vote up
def setup(app):
    app.connect('builder-inited', run_apidoc)
    
    app.connect("autodoc-skip-member", skip)
    #Allow MarkDown
    app.add_config_value('recommonmark_config', {
            'url_resolver': lambda url: "build/apidoc/" + url,
			'auto_toc_tree_section': ['Contents','Examples'],
            'enable_eval_rst': True,
			#'enable_auto_doc_ref': True,
			'enable_math': True,
			'enable_inline_math': True
            }, True)
    app.add_transform(AutoStructify)


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
# 
Example #6
Source File: conf.py    From py-ipfs-http-client with MIT License 6 votes vote down vote up
def section_property_attrgetter(object, name, default=None):
	try:
		prop = sphinx.util.inspect.safe_getattr(object, name)
		
		# Try returning the underlying section property class
		try:
			return sphinx.util.inspect.safe_getattr(prop, "__prop_cls__")
		except AttributeError:
			pass
		
		# Return object itself
		return prop
	except AttributeError as e:
		pass
	
	# Nothing found: Return default
	return default


# app setup hook for reCommonMark's AutoStructify and our own extension 
Example #7
Source File: conf.py    From py-ipfs-http-client with MIT License 6 votes vote down vote up
def setup(app):
	# Ensure we are building with reCommonMark 0.5+
	import recommonmark
	assert tuple(int(v) for v in recommonmark.__version__.split(".", 2)[0:2]) >= (0, 5)
	
	from recommonmark.transform import AutoStructify
	app.add_config_value("recommonmark_config", {
		"auto_toc_tree_section": "Contents",
	}, True)
	app.add_transform(AutoStructify)
	
	# Add special documentation for `Client` class
	app.add_autodocumenter(ClientClassDocumenter)
	# Allow names to be resolved through the property objects of the client
	# class without resorting to lots of name rewriting (as was the case with
	# the previous implementation)
	app.add_autodoc_attrgetter(object, section_property_attrgetter) 
Example #8
Source File: conf.py    From dftimewolf with Apache License 2.0 5 votes vote down vote up
def setup(app):
  """Add custom parsers to Sphinx generation."""
  app.add_config_value('recommonmark_config', {
      'enable_auto_doc_ref': False,
      }, True)
  app.add_transform(AutoStructify)
  app.add_transform(ProcessLink) 
Example #9
Source File: conf.py    From MXFusion with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
            'url_resolver': lambda url: github_doc_root + url,
            'enable_auto_toc_tree': True,
            }, True)
    app.add_transform(AutoStructify) 
Example #10
Source File: conf.py    From fabric-sdk-py with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        # 'url_resolver': lambda url: github_doc_root + url,
        'enable_auto_toc_tree': True
    }, True)
    app.add_transform(AutoStructify)

# -- Project information ----------------------------------------------------- 
Example #11
Source File: conf.py    From paperboy with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'auto_toc_tree_section': 'Contents',
    }, True)
    app.add_transform(AutoStructify)
    app.connect('builder-inited', run_copyreadme)
    app.connect('builder-inited', run_apidoc) 
Example #12
Source File: conf.py    From nni with MIT License 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'enable_eval_rst': True,
        'enable_auto_toc_tree': False,
    }, True)
    app.add_transform(AutoStructify)
    app.add_stylesheet('css/custom.css') 
Example #13
Source File: conf.py    From CausalDiscoveryToolbox with MIT License 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
            }, True)
    app.add_transform(AutoStructify)
    app.add_stylesheet('custom.css') 
Example #14
Source File: conf.py    From var-attn with MIT License 5 votes vote down vote up
def setup(app):
    print("hello")
    app.add_config_value('recommonmark_config', {
        'enable_eval_rst': True
    }, True)
    app.add_transform(AutoStructify) 
Example #15
Source File: conf.py    From toad with MIT License 5 votes vote down vote up
def setup(app):
    app.add_config_value(
        'recommonmark_config',
        {
            'enable_eval_rst': True,
            'enable_auto_toc_tree': True,
            'auto_toc_tree_section': 'Contents',
        },
        True,
    )

    app.add_transform(AutoStructify) 
Example #16
Source File: conf.py    From FeatureHub with MIT License 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
            'url_resolver': lambda url: github_root + url,
            'auto_toc_tree_section': 'Contents',
            }, True)
    app.add_transform(AutoStructify)

# The master toctree document. 
Example #17
Source File: conf.py    From geos with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
            'url_resolver': lambda url: '' + url,
            'auto_toc_tree_section': 'Contents',
            'enable_eval_rst' : True,
            'enable_inline_math' : True,
            'enable_math' : True,
            }, True)
    app.add_transform(AutoStructify) 
Example #18
Source File: conf.py    From pympress with GNU General Public License v2.0 5 votes vote down vote up
def setup(app):
    """ Function called by sphinx to setup this documentation.
    """
    app.add_config_value('recommonmark_config', {
        'url_resolver': lambda url: url[3:] if url.startswith('../README') else url,
        'enable_auto_toc_tree': True,
        'auto_toc_maxdepth': 2,
        'auto_toc_tree_section': 'Contents',
        'enable_eval_rst': True
    }, True)
    app.add_transform(AutoStructify)

    # get the README.md as a source, but we need to move it here and adjust the relative links into docs/
    # Until relative links are allowed from the toctree, see https://github.com/sphinx-doc/sphinx/issues/701
    find_links = re.compile(r'\[([^\[\]]+)\]\(([^()]+)\)')

    here = os.path.dirname(__file__)
    with open(os.path.join(here, '..', 'README.md')) as fin, open(os.path.join(here, 'README.md'), 'w') as fout:
        for l in fin:
            print(find_links.sub(lambda m: '[{}]({})'.format(m[1], rewrite_link(m[2])), l), end='', file=fout)

    app.connect('build-finished', lambda app, config: os.unlink(os.path.join(app.srcdir, 'README.md')))


# The encoding of source files.
#
# source_encoding = 'utf-8-sig'

# The master toctree document. 
Example #19
Source File: conf.py    From blackmamba with MIT License 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'enable_eval_rst': True,
        'enable_auto_doc_ref': True,
        'auto_toc_tree_section': False
        }, True)
    app.add_transform(AutoStructify) 
Example #20
Source File: conf.py    From ipmininet with GNU General Public License v2.0 5 votes vote down vote up
def setup(app):
    # AutoStructify configuration
    app.add_config_value('recommonmark_config', {
        'auto_toc_tree_section': 'Contents',
        'enable_eval_rst': True,
    }, True)
    app.add_transform(AutoStructify)

    # from m2r to make `mdinclude` work
    app.add_config_value('no_underscore_emphasis', False, 'env')
    app.add_config_value('m2r_parse_relative_links', False, 'env')
    app.add_config_value('m2r_anonymous_references', False, 'env')
    app.add_config_value('m2r_disable_inline_math', False, 'env')
    app.add_directive('mdinclude', MdInclude) 
Example #21
Source File: conf.py    From wavectl with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'enable_eval_rst': True,
    }, True)
    app.add_transform(AutoStructify)


# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md'] 
Example #22
Source File: conf.py    From bandersnatch with Academic Free License v3.0 5 votes vote down vote up
def setup(app):
    if USE_MARKDOWN:
        print("Adding recommonmark settings")
        app.add_config_value(
            "recommonmark_config",
            {
                "url_resolver": lambda url: github_doc_root + url,
                "auto_toc_tree_section": "Contents",
                "enable_eval_rst": True,
            },
            True,
        )
        app.add_transform(AutoStructify) 
Example #23
Source File: conf.py    From nnabla with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'auto_toc_tree_section': 'Contents',
    }, True)
    app.add_transform(AutoStructify)
    app.add_stylesheet('custom.css') 
Example #24
Source File: conf.py    From nbcelltests with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'auto_toc_tree_section': 'Contents',
    }, True)
    app.add_transform(AutoStructify)
    app.connect('builder-inited', run_copyreadme)
    app.connect('builder-inited', run_apidoc) 
Example #25
Source File: conf.py    From espnet with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'url_resolver': lambda url: github_doc_root + url,
        'auto_toc_tree_section': 'Contents',
    }, True)
    app.add_transform(AutoStructify)


# The master toctree document. 
Example #26
Source File: conf.py    From docs with MIT License 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
            'enable_auto_doc_ref': True,
            'enable_inline_math': False,
            'enable_auto_toc_tree': False
            }, True)
    app.add_transform(AutoStructify) 
Example #27
Source File: conf.py    From jupyterlab_commands with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'auto_toc_tree_section': 'Contents',
    }, True)
    app.add_transform(AutoStructify)
    app.connect('builder-inited', run_copyreadme)
    app.connect('builder-inited', run_apidoc) 
Example #28
Source File: conf.py    From tensorforce with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', recommonmark_config, True)
    app.add_transform(AutoStructify)
    app.connect('autodoc-process-docstring', process_docstring) 
Example #29
Source File: conf.py    From chepy with GNU General Public License v3.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
            'enable_eval_rst': True,
            }, True)
    app.add_transform(AutoStructify)


# -- Project information ----------------------------------------------------- 
Example #30
Source File: conf.py    From baal with Apache License 2.0 5 votes vote down vote up
def setup(app):
    app.add_config_value('recommonmark_config', {
        'enable_auto_toc_tree': True,
        'enable_eval_rst': True,
        'enable_math': True,
        'enable_inline_math': True,
        'auto_toc_tree_section': 'Contents',
    }, True)
    app.add_transform(AutoStructify)