# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import docutils import os # -- Project information ----------------------------------------------------- project = 'Flame' copyright = '2021, Blue Fire Team' author = 'Blue Fire Team' root_doc = "index" # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'myst_parser', # Markdown support 'sphinxcontrib.mermaid', ] # Configuration options for MyST: # https://myst-parser.readthedocs.io/en/latest/syntax/optional.html myst_enable_extensions = [ 'dollarmath', 'html_admonition', 'html_image', 'linkify', 'replacements', 'smartquotes', ] # Auto-generate link anchors for headers at levels H1 and H2 myst_heading_anchors = 4 # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'summary.md'] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. html_theme = "flames" html_theme_options = {} html_title = "Flame" html_logo = "images/logo_flame.png" html_favicon = "images/favicon.ico" # Style for syntax highlighting pygments_style = 'monokai' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['images', 'scripts', 'theme'] html_js_files = ['versions.js'] # -- Custom setup ------------------------------------------------------------ class TitleCollector(docutils.nodes.SparseNodeVisitor): def __init__(self, document): self.level = 0 self.titles = [] super().__init__(document) def visit_section(self, node): title_class = docutils.nodes.title self.level += 1 if node.children and isinstance(node.children[0], title_class): title = node.children[0].astext() node_id = node.get("ids")[0] self.titles.append([title, node_id, self.level]) def depart_section(self, node): self.level -= 1 def get_local_toc(document): if not document: return "" visitor = TitleCollector(document) document.walkabout(visitor) titles = visitor.titles if not titles: return "" levels = sorted(set(item[2] for item in titles)) if levels.index(titles[0][2]) != 0: return document.reporter.error( "First title on the page is not
") del titles[0] # remove the